Audio Transcoding Question
Hello! I use ffmpeg to transcode audio files from an arbitrary (decodable for my installation of ffmpeg and according libraries) format to a certain fomat (ie. libmp3lame, 128kbit, 44100kHz). I did this with the following command: ffmpeg -y -i my_input_file -ab 128k -ar 44100 -acodec libmp3lame my_output_file This worked fine for 99% of all files I had to handle. Recently I stumbled into files where the transcoding wasn't performed, but I got the following ouput: ffmpeg -y -i my_input_file -ab 128k -ar 44100 -acodec libmp3lame my_output_file FFmpeg version SVN-r22565, Copyright (c) 2000-2010 the FFmpeg developers built on Mar 16 2010 15:08:31 with gcc 4.0.1 (Apple Inc. build 5493) configuration: --enable-shared --enable-libmp3lame --disable-mmx libavutil 50.12. 0 / 50.12. 0 libavcodec 52.59. 0 / 52.59. 0 libavformat 52.56. 0 / 52.56. 0 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0.10. 0 / 0.10. 0 [mp3 @ 0x1802600]max_analyze_duration reached [mp3 @ 0x1802600]Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'my_input_file': Duration: 00:52:23.62, start: 0.000000, bitrate: 128 kb/s Stream #0.0: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s Unable to find a suitable output format for 'my_output_file' I read the doc, faq and googled and the solution i came up with is to use the '-f fmt' option in the way of '-f mp3'. So I am about to change my call to: ffmpeg -y -i my_input_file -ab 128k -ar 44100 -acodec libmp3lame -f mp3 my_output_file If I use ffmpeg with these parameters I get the desired output file and a lot of error messages like: Press [q] to stop encoding [mp3 @ 0x1803600]Header missing Error while decoding stream #0.0 ... Error while decoding stream #0.0 Error while decoding stream #0.0ate= 128.0kbits/s Error while decoding stream #0.0 Last message repeated 5 times [mp3 @ 0x1803600]overread, skip -4 enddists: -1 -1 [mp3 @ 0x1803600]overread, skip -7 enddists: -3 -3 Last message repeated 1 times [mp3 @ 0x1803600]overread, skip -7 enddists: -4 -4 [mp3 @ 0x1803600]Header missing Error while decoding stream #0.0 .... Error while decoding stream #0.0 Last message repeated 14 times [mp3 @ 0x1803600]overread, skip -5 enddists: -1 -1 [mp3 @ 0x1803600]overread, skip -5 enddists: -3 -3 [mp3 @ 0x1803600]overread, skip -5 enddists: -4 -4 [mp3 @ 0x1803600]overread, skip -7 enddists: -4 -4 [mp3 @ 0x1803600]Header missing Error while decoding stream #0.0 ... Error while decoding stream #0.0 Last message repeated 3 times [mp3 @ 0x1803600]overread, skip -6 enddists: -5 -5 [mp3 @ 0x1803600]overread, skip -8 enddists: -5 -5 [mp3 @ 0x1803600]Header missingrate= 128.0kbits/s The question I have now is, could someone explain to me what is actually happening if i use the -f parameter. The doc is not very exhaustive about it and only says: `-f fmt' - Force format. Does the -f option influence how the input is understood or how the output file is generated? Why is the -acodec libmp3lame option not sufficient? Do I keep the ability to decode various input formats and generate a mp3 while using '-f mp3'? Are those error messages I get critical (the generated mp3 does sound ok)? Thank you very much for any information in advance! Steffn
On Mar 17 15:45:01, Steffn wrote:
Hello!
I use ffmpeg to transcode audio files from an arbitrary (decodable for my installation of ffmpeg and according libraries) format to a certain fomat (ie. libmp3lame, 128kbit, 44100kHz). I did this with the following command: ffmpeg -y -i my_input_file -ab 128k -ar 44100 -acodec libmp3lame my_output_file
This worked fine for 99% of all files I had to handle. Recently I stumbled into files where the transcoding wasn't performed, but I got the following ouput:
ffmpeg -y -i my_input_file -ab 128k -ar 44100 -acodec libmp3lame my_output_file FFmpeg version SVN-r22565, Copyright (c) 2000-2010 the FFmpeg developers built on Mar 16 2010 15:08:31 with gcc 4.0.1 (Apple Inc. build 5493) configuration: --enable-shared --enable-libmp3lame --disable-mmx libavutil 50.12. 0 / 50.12. 0 libavcodec 52.59. 0 / 52.59. 0 libavformat 52.56. 0 / 52.56. 0 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0.10. 0 / 0.10. 0 [mp3 @ 0x1802600]max_analyze_duration reached [mp3 @ 0x1802600]Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'my_input_file': Duration: 00:52:23.62, start: 0.000000, bitrate: 128 kb/s Stream #0.0: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s Unable to find a suitable output format for 'my_output_file'
First of all, the input already _is_ a stereo/44100/s16 mp3 file at 128kb/s. Why are you even reencoding it? Second of all, is the above your real command line? Do you really have a file named 'my_input_file'? It is apparently an mp3 file, so why don't you name it whatever.mp3, easing the job of all applications that have to work with it? Third of all, why don't you name the output file as *.mp3, when you want to write an mp3 file? That would imply the 'suitable output format' immediately.
I read the doc, faq and googled and the solution i came up with is to use the '-f fmt' option in the way of '-f mp3'. So I am about to change my call to: ffmpeg -y -i my_input_file -ab 128k -ar 44100 -acodec libmp3lame -f mp3 my_output_file
my_output_file.mp3 would be a better name; no need to specify '-f mp3' then.
If I use ffmpeg with these parameters I get the desired output file and a lot of error messages like: Press [q] to stop encoding [mp3 @ 0x1803600]Header missing Error while decoding stream #0.0 ... Error while decoding stream #0.0 Error while decoding stream #0.0ate= 128.0kbits/s Error while decoding stream #0.0 Last message repeated 5 times [mp3 @ 0x1803600]overread, skip -4 enddists: -1 -1 [mp3 @ 0x1803600]overread, skip -7 enddists: -3 -3 Last message repeated 1 times [mp3 @ 0x1803600]overread, skip -7 enddists: -4 -4 [mp3 @ 0x1803600]Header missing Error while decoding stream #0.0 .... Error while decoding stream #0.0 Last message repeated 14 times [mp3 @ 0x1803600]overread, skip -5 enddists: -1 -1 [mp3 @ 0x1803600]overread, skip -5 enddists: -3 -3 [mp3 @ 0x1803600]overread, skip -5 enddists: -4 -4 [mp3 @ 0x1803600]overread, skip -7 enddists: -4 -4 [mp3 @ 0x1803600]Header missing Error while decoding stream #0.0 ... Error while decoding stream #0.0 Last message repeated 3 times [mp3 @ 0x1803600]overread, skip -6 enddists: -5 -5 [mp3 @ 0x1803600]overread, skip -8 enddists: -5 -5 [mp3 @ 0x1803600]Header missingrate= 128.0kbits/s
The question I have now is, could someone explain to me what is actually happening if i use the -f parameter. The doc is not very exhaustive about it and only says: `-f fmt' - Force format.
You are using '-f mp3' as an option for the output format, thus telling ffmpeg to write an mp3 file; which, again, would be more elegantly achieved by simply naming the output file as *.mp3. But the errors you quote above are errors in the _input_.
Does the -f option influence how the input is understood or how the output file is generated?
Depends on whether it's an optio to the input file or an option to the output file. In your case, it influences the output, namely, it makes ffmpeg write an mp3 file (named 'my_output_file' for reasons unknown).
Why is the -acodec libmp3lame option not sufficient?
"Sufficient" for what? To imply that the output file should be in the mp3 format? There are many other _container_file_formats_ that can hold an mp3 _audio_stream_ inside. These are two different things. I can have an *.avi file holding no video and one audio stream created using the 'libmp3lame' codec. That doesn't imply it is an mp3 file (which it is not).
Do I keep the ability to decode various input formats and generate a mp3 while using '-f mp3'?
Of course. But why would you encode an mp3 into an mp3 in the first place?
Are those error messages I get critical (the generated mp3 does sound ok)?
Those are errors in the input mp3 file; perhaps it is broken; god knows from which interwebz it comes and what broken software created it. These errors are not necessarily audible. The line
Duration: 00:52:23.62, start: 0.000000, bitrate: 128 kb/s suggests it's a pretty big file (52 minutes of 128kb/s audio). If it's not, can you put it somewhere for us to see?
Finally, as you are only dealing with audio, you might want to try using sox(1) instead.
participants (2)
-
hans@stare.cz -
steffn@gmx.at