[Ffmpeg-devel] Audio bitrate

Michael Niedermayer michaelni
Mon Nov 6 19:03:52 CET 2006


Hi

On Mon, Nov 06, 2006 at 06:07:53PM +0100, Michel Bardiaux wrote:
> Michael Niedermayer wrote:
> >Hi
> >
> >On Mon, Nov 06, 2006 at 05:28:24PM +0100, Michel Bardiaux wrote:
> >>Michael Niedermayer wrote:
> >>>Hi
> >>>
> >>>On Mon, Nov 06, 2006 at 04:49:46PM +0100, Michel Bardiaux wrote:
> >>>>Seems wrong in some cases:
> >>>>
> >>>>ffmpeg -i utc_1434.mpg -vn -acodec adpcm_ms -y -ar 8000 msadpcm.wav
> >>>>FFmpeg version SVN-r6917, Copyright (c) 2000-2006 Fabrice Bellard, et 
> >>>>al.
> >>>> configuration:
> >>>> libavutil version: 49.0.2
> >>>> libavcodec version: 51.24.0
> >>>> libavformat version: 51.6.0
> >>>> built on Nov  6 2006 16:13:12, gcc: 3.3.5 (Debian 1:3.3.5-13)
> >>>>Input #0, mpeg, from 'utc_1434.mpg':
> >>>> Duration: 00:00:57.0, start: 92564.370489, bitrate: 668 kb/s
> >>>> Stream #0.0[0x1e0]: Video: mpeg1video, yuv420p, 352x288, 104857 kb/s, 
> >>>>25.00 fps(r)
> >>>> Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, mono, 32 kb/s
> >>>>Output #0, wav, to 'msadpcm.wav':
> >>>> Stream #0.0: Audio: adpcm_ms, 8000 Hz, mono, 64 kb/s
> >>>>Stream mapping:
> >>>> Stream #0.1 -> #0.0
> >>>>Press [q] to stop encoding
> >>>>size=     235kB time=59.8 bitrate=  32.2kbits/s
> >>>>video:0kB audio:235kB global headers:0kB muxing overhead 0.018285%
> >>>>
> >>>>Should be 32kbits in the 0.0 line.
> >>>>
> >>>>With pcm_s16le, the bitrate is correct. But I dont see at once where it 
> >>>>is set. "Use the source, Luke", all right, but if somebody just 
> >>>>*knows*...
> >>>ffmpeg.c audio_bit_rate default i guess
> >>>changing that of course wont help ...
> >>No. And after a bit of grepping, it appears that the only reason the 
> >>message is right when pcm is used, is because avcodec_string 
> >>deliberately ignores bitrate in the codec and recomputes. So, even 
> >>though the output is right, the internal state is *not*. Which is rotten 
> >>for those using the libs instead of the command line.
> >>
> >>>you could try to set AVCodecContext.bitrate in adpcm.c to the correct 
> >>>value
> >>>but iam not sure if this is free of sideeffects
> >>IMHO the init method of a codec with a fixed bitrate, should force the 
> >>correct value. Unfortunately, the init method is called LONG after 
> >>avcodec_string is used. Maybe we need to add a method for codecs; one 
> >>that should be called to change desired bitrate, framerate, number of 
> >>channels, or to retrieve bitrate.
> >
> >add a list to AVCodec similar to supported_framerates
> >
> >[...]
> 
> And how would that help?

ffmpeg.c could select a default bitrate which is one of the supported
ones before init, similar to the framerate and pix_fmt

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list