[FFmpeg-user] How to make CBR AAC

Martin Vignali martin.vignali at gmail.com
Thu Nov 3 17:46:01 EET 2016


Hello,

I need to create mp4 file with aac audio with a 256kbits average bitrate.

The problem, is that my file, have lot of silence, but i need to have an
average audio bitrate very close to 256k.


Is there a way, to force the aac encoder to add some "fill" in order to
appear like a cbr bitrate (like X264 can do)

I try to increase the bitrate, but aac encoder seems to have a bitrate
limit, and even if i use the max allowed bitrate, the resulting file is
under 256kb/s (216 in that case)

---------------------- FFmpeg (Zeranoe build here)
--------------------------------------------

"C:\Program Files\ffmpeg-20161103-3932ccc-win64-static\bin\ff
mpeg.exe" -i "C:\audioTrack.wav" -c:a aac -b:a 256k -minrate 256k -maxrate
256k
"D:\resA.m4a"
ffmpeg version N-82215-g3932ccc Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dx
va2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib
--enable-lib
ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--ena
ble-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libfree
type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug
--enab
le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-lib
openh264 --enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschr
oedinger --enable-libsnappy --enable-libsoxr --enable-libspeex
--enable-libtheor
a --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc
--enable-libvo
rbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--ena
ble-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --e
nable-decklink --enable-zlib
  libavutil      55. 35.100 / 55. 35.100
  libavcodec     57. 66.100 / 57. 66.100
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 66.100 /  6. 66.100
  libswscale      4.  3.100 /  4.  3.100
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'C:\audioTrack.wav':
  Metadata:
    encoder         : Lavf57.8.102
  Duration: 00:00:26.00, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
stereo, s16
, 1536 kb/s
Output #0, ipod, to 'D:\resA.m4a':
  Metadata:
    encoder         : Lavf57.57.100
    Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 25
6 kb/s
    Metadata:
      encoder         : Lavc57.66.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
size=     493kB time=00:00:26.00 bitrate= 155.2kbits/s speed=21.7x
video:0kB audio:487kB subtitle:0kB other streams:0kB global headers:0kB
muxing o
verhead: 1.128232%
[aac @ 000000000051f260] Qavg: 31996.516


---------------------- FFprobe :
Result--------------------------------------------

"C:\Program Files\ffmpeg-20161103-3932ccc-win64-static\bin\ff
probe.exe" "D:\resA.m4a"
ffprobe version N-82215-g3932ccc Copyright (c) 2007-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dx
va2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib
--enable-lib
ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--ena
ble-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libfree
type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug
--enab
le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-lib
openh264 --enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschr
oedinger --enable-libsnappy --enable-libsoxr --enable-libspeex
--enable-libtheor
a --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc
--enable-libvo
rbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--ena
ble-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --e
nable-decklink --enable-zlib
  libavutil      55. 35.100 / 55. 35.100
  libavcodec     57. 66.100 / 57. 66.100
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 66.100 /  6. 66.100
  libswscale      4.  3.100 /  4.  3.100
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\resA.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: isomiso2
    encoder         : Lavf57.57.100
  Duration: 00:00:26.02, start: 0.000000, bitrate: 155 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, flt
p, 153 kb/s (default)
    Metadata:
      handler_name    : SoundHandler




Thanks by advance

Martin


More information about the ffmpeg-user mailing list