I record audio successfully from an URL that it seems to be mp3 source, sending this command.
$ ffmpeg -y -t "00:01:00" -i $url1 -c copy url1.mp3
ffmpeg version N-93762-ge384f6f2f9 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7.4.0 (GCC)
configuration:
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 52.100 / 58. 52.100
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 50.100 / 7. 50.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
Input #0, mp3, from 'http://someurl1:1234':
Now, I get error when I try to record from another URL that seems to be AAC audio source.
$ ffmpeg -y -t "00:01:00" -i $url2 -c copy url2.mp3
ffmpeg version N-93762-ge384f6f2f9 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7.4.0 (GCC)
configuration:
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 52.100 / 58. 52.100
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 50.100 / 7. 50.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
Input #0, aac, from 'http://someurl2:1234':
Metadata:
icy-notice1 : <BR>This stream requires Winamp<BR>
icy-notice2 : SHOUTcast DNAS/posix(linux x64) v2.5.5.733<BR>
icy-name : some name
icy-genre : Talk
icy-br : 48
icy-sr : 22050
icy-url :
icy-pub : 0
StreamTitle : some title
Duration: N/A, bitrate: 47 kb/s
Stream #0:0: Audio: aac (HE-AACv2), 44100 Hz, stereo, fltp, 47 kb/s
[mp3 # 0x80003c280] Invalid audio stream. Exactly one MP3 audio stream is required.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Last message repeated 1 times
If I try to save it as aac file I get this message:
$ ffmpeg -y -t "00:01:00" -i $url2 -c copy url2.aac
ffmpeg version N-93762-ge384f6f2f9 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7.4.0 (GCC)
configuration:
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 52.100 / 58. 52.100
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 50.100 / 7. 50.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
Input #0, aac, from 'http://someurl2:1234':
Metadata:
icy-notice1 : <BR>This stream requires Winamp<BR>
icy-notice2 : SHOUTcast DNAS/posix(linux x64) v2.5.5.733<BR>
icy-name : some name
icy-genre : Talk
icy-br : 48
icy-sr : 22050
icy-url :
icy-pub : 0
StreamTitle : some title
Duration: N/A, bitrate: 48 kb/s
Stream #0:0: Audio: aac (HE-AACv2), 44100 Hz, stereo, fltp, 48 kb/s
Output #0, adts, to 'url2.aac':
Metadata:
icy-notice1 : <BR>This stream requires Winamp<BR>
icy-notice2 : SHOUTcast DNAS/posix(linux x64) v2.5.5.733<BR>
icy-name : some name
icy-genre : Talk
icy-br : 48
icy-sr : 22050
icy-url :
icy-pub : 0
StreamTitle : some title
encoder : Lavf58.27.103
Stream #0:0: Audio: aac (HE-AACv2), 44100 Hz, stereo, fltp, 48 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
How to record when the source audio from URL is aac?
Is there a way to identify before recording if it is mp3 or aac? Thanks in advance
In your first command, using -c copy is wrong, because you need to reencode from aac (HE-AACv2) to mp3.
See ffmpeg documentation:
a special value copy (output only) to indicate that the stream is not to be re-encoded
I suggest you try this:
ffmpeg -y -t "00:01:00" -i [stream URL] -codec:a libmp3lame output.mp3
Unfortunately, I could not test it against the URL you provided in the comments (http://dreamsiteradiocp4.com:8120/: Connection refused), but it successfully worked with AAC streams listed at fmstream.org.
Reference: video.stackexchange.com
Related
Practicing FFMPEG filters on MP3s was great until I got stuck here with no luck reading from FFMPEG docs or around the web: equalizer filter has no effect at all on my MP3.
First I probed the file:
libavutil 56. 49.100 / 56. 49.100
libavcodec 58. 89.100 / 58. 89.100
libavformat 58. 43.100 / 58. 43.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 83.100 / 7. 83.100
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, mp3, from '.\cierre.mp3':
Metadata:
major_brand : 3gp4
minor_version : 0
compatible_brands: isom3gp4
com.android.version: 10
encoder : Lavf58.43.100
Duration: 00:00:14.92, start: 0.000000, bitrate: 64 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 64 kb/s
Then I triy different combinations, understanding this would increase frequency at 1KHZ by 20 DBs, but I hear no difference inbetween source and result:
.\ffmpeg -i .\cierre.mp3 -filter_complex equalizer=f=1000:g=20:c=1 -c:a libmp3lame equalized.mp3
Also if I ommit the (only?) channel (because as per FFPROBE it is "MONO")
.\ffmpeg -i .\cierre.mp3 -filter_complex equalizer=f=1000:g=20:c=1 libmp3lame equalized.mp3
Is there anything to consider about the MP3? If I use VLC player's equalizer "1khz" is one of the frequencies. Other frequencies like 60HZ and 6000HZ do not show any impact either.
Thanks!
Ahah sorry, I was just no making significant changes, it was working just fine all the time, i-e- +20dB to frequency 60, too low, not noticeable - ofcourse it seems to deppend on the source properties itself.
Thanks!
I have a UVC camera /dev/video1. The Camera will be always on. but I only care about the last 1 min data stream.
after searching online I got a ffmpeg cmd:
./ffmpeg -f v4l2 -input_format mjpeg -video_size 320x240 -i /dev/video1 -c copy -f segment -segment_time 60 -segment_wrap 2 output.mkv
However I got a error and here is the result
libavutil 56. 56.100 / 56. 56.100
libavcodec 58. 97.100 / 58. 97.100
libavformat 58. 49.100 / 58. 49.100
libavdevice 58. 11.101 / 58. 11.101
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Input #0, matroska,webm, from '/sdcard/Movies/output.mkv':
Metadata:
ENCODER : Lavf58.49.100
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 320x240, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
[matroska # 0x3899e10] Invalid segment filename template 'output.mkv'
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
You're using the segment muxer, which expects to write multiple files. So it expects the filename to have a format specifier for the serial number. The simplest one is %d which will be replaced by a number without padding.
ffmpeg -f v4l2 -input_format mjpeg -video_size 320x240 -i /dev/video1 -c copy -f segment -segment_time 60 -segment_wrap 2 output%d.mkv
"volume" filter does not work in complex filter. The volume is not affected in the converted audio.
env: Mac OS 10.12.6
ffmpeg -i /path/bg.mp3 -y -filter_complex [0:0]volume=0[output] -map
[output] -acodec libmp3lame -write_xing 0 /path/mixed.mp3
full log =====================================================================
liqideMacBook-Pro:pinyin-api work$ ffmpeg -i
/Users/work/dev/codebase/pinyin/pinyin-api/test/resources/bg_audio2.mp3
-y -filter_complex [0:0]volume=0.1[output] -map [output] -acodec
libmp3lame -f mp3 -write_xing 0 /Users/work/dev/codebase/pinyin/pinyin-
api/test/resources/mixed3.mp3
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-
shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --
enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-
gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-
opencl --enable-videotoolbox --disable-lzma
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mp3, from '/Users/work/dev/codebase/pinyin/pinyin-
api/test/resources/bg_audio2.mp3':
Metadata:
title : 喜洋洋
album : 贺岁新年音乐会
encoder : Lavf56.4.101
Duration: 00:02:43.58, start: 0.025057, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Stream mapping:
Stream #0:0 (mp3) -> volume
volume -> Stream #0:0 (libmp3lame)
Press [q] to stop, [?] for help
Output #0, mp3, to '/Users/work/dev/codebase/pinyin/pinyin-
api/test/resources/mixed3.mp3':
Metadata:
TIT2 : 喜洋洋
TALB : 贺岁新年音乐会
TSSE : Lavf57.83.100
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp
Metadata:
encoder : Lavc57.107.100 libmp3lame
[libmp3lame # 0x7fad80001a00] Trying to remove 1152 samples, but the
queue is empty
size= 2556kB time=00:02:43.57 bitrate= 128.0kbits/s speed=51.7x
video:0kB audio:2556kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.003782%
liqideMacBook-Pro:pinyin-api work$
=====================================================================
While I am trying to convert wav file to wma file size is becomes much larger than original source file:
input.wav - 11M
output.wma - 16M
Is there any way to reduce file size of output file?
Command and output:
$ ffmpeg -i input.wav -c copy output.wma
ffmpeg version N-80797-g8b4d6cc Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 6.1.1 (GCC) 20160501
configuration: --enable-gpl
libavutil 55. 27.100 / 55. 27.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 40.101 / 57. 40.101
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 46.102 / 6. 46.102
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'input.wav':
Metadata:
encoder : Lavf57.40.101
Duration: 00:01:00.00, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Output #0, asf, to 'output.wma':
Metadata:
WM/EncodingSettings: Lavf57.40.101
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, 1411 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 16150kB time=00:01:00.00 bitrate=2205.1kbits/s speed=1.9e+03x
video:0kB audio:10336kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 56.255745%
WMA is crappy. Try changing the packet size. From FFmpeg ASF muxer documentation:
-packet_size
Set the muxer packet size. By tuning this setting you
may reduce data fragmentation or muxer overhead depending on your
source. Default value is 3200, minimum is 100, maximum is 64k.
Example:
ffmpeg -i input.wav -c copy -packet_size 65536 output_64k.wma
File sizes:
input.wav - 11M
output_64k.wma - 11M
output_default.wma - 16M
I have installed ffmpeg on cygwin from source code. I need to convert mp3 files to raw audio, but it fails with the following error message:
Assertion !link->frame_requested || link->flags & FF_LINK_FLAG_REQUEST_LOOP failed
at libavfilter/avfilter.c:360
Do I have some codec missing? Any help would be appreciated.
Here's the full output of ffmpeg (audio metadata snipped):
$ ffmpeg -i 2quickstart.mp3 -ac 1 -ar 11025 -f s16le -t 20 -ss 10 2quickstart.raw
ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 20 2013 13:26:12 with gcc 4.8.2 (GCC)
configuration:
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
[mp3 # 0x80022040] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '2quickstart.mp3':
Metadata:
--snip--
Duration: 00:03:37.87, start: 0.000000, bitrate: 255 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 256 kb/s
Output #0, s16le, to '2quickstart.raw':
Metadata:
--snip--
encoder : Lavf55.19.104
Stream #0:0: Audio: pcm_s16le, 11025 Hz, mono, s16, 176 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mp3 -> pcm_s16le)
Press [q] to stop, [?] for help
Assertion !link->frame_requested || link->flags & FF_LINK_FLAG_REQUEST_LOOP failed
at libavfilter/avfilter.c:360
Aborted (core dumped)