[Ffmpeg-devel] FAAC rate control broken?
Luca Abeni
lucabe72
Tue Dec 20 16:31:11 CET 2005
Hi all,
I am trying to encode some AAC audio with ffmpeg (+ libfaac, version
1.24), but it seems that the "-ab" option does not work...
Here is a way to reproduce the problem:
1) capture some PCM audio:
./ffmpeg -ac 2 test.wav
2) encode it with aac at 60kbps:
./ffmpeg -i test.wav -ab 64 -acodec aac a.wav
ffmpeg version CVS, build 3342336, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --cc=gcc-4.0 --enable-faac --disable-network --disable-zlib --disable-vhook --disable-ffplay --extra-cflags=-I /tmp/aac/include --extra-ldflags=-L /tmp/aac/lib
built on Dec 21 2005 00:30:58, gcc: 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
Input #0, wav, from 'test.wav':
Duration: 00:00:35.5, start: 0.000000, bitrate: 1411 kb/s
Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, 1411 kb/s
File 'a.wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'a.wav':
Stream #0.0: Audio: aac, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 356kB time=35.5 bitrate= 82.1kbits/s
(so, the output bitrate is 82.1kbps)
3) Encode at 40kbps
./ffmpeg -i test.wav -ab 40 -acodec aac b.wav
ffmpeg version CVS, build 3342336, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --cc=gcc-4.0 --enable-faac --disable-network --disable-zlib --disable-vhook --disable-ffplay --extra-cflags=-I /tmp/aac/include --extra-ldflags=-L /tmp/aac/lib
built on Dec 21 2005 00:30:58, gcc: 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
Input #0, wav, from 'test.wav':
Duration: 00:00:35.5, start: 0.000000, bitrate: 1411 kb/s
Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, 1411 kb/s
Output #0, wav, to 'b.wav':
Stream #0.0: Audio: aac, 44100 Hz, stereo, 40 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 356kB time=35.5 bitrate= 82.1kbits/s
(still 82.1kbps...)
So, it seems that the bitrate control is not working very well... :(
I tried to have a look at libavcodec/faac.c, and it seems that the
problem is that Faac_encode_init() does not set faac_cfg->bandWidth...
As an experiment, I tried to set it to
avctx->bit_rate / avctx->channels / 2
and things look a little bit better:
./ffmpeg -i test.wav -ab 40 -acodec aac a.wav
ffmpeg version CVS, build 3342336, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --cc=gcc-4.0 --enable-faac --disable-network --disable-zlib --disable-vhook --disable-ffplay --extra-cflags=-I /tmp/aac/include --extra-ldflags=-L /tmp/aac/lib
built on Dec 21 2005 00:30:58, gcc: 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
Input #0, wav, from 'test.wav':
Duration: 00:00:35.5, start: 0.000000, bitrate: 1411 kb/s
Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, 1411 kb/s
File 'a.wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'a.wav':
Stream #0.0: Audio: aac, 44100 Hz, stereo, 40 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 275kB time=35.5 bitrate= 63.5kbits/s
still the wrong bitrate (63.5 instead of 40), but it is less than with
-ab 64...
Does anyone have any idea about how to fix the problem?
Thanks,
Luca
--
_____________________________________________________________________________
Copy this in your signature, if you think it is important:
N O W A R ! ! !
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Rc auto Zuritel. Risparmiare ? un gioco da ragazzi. Prova ora.
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4098&d=20-12
More information about the ffmpeg-devel
mailing list