Opened 13 years ago

Closed 13 years ago

#491 closed defect (fixed)

ffmpeg's -b option (bitrate) overrides audio bitrate

Reported by: Jean-Baptiste Mardelle Owned by: Michael Niedermayer
Priority: normal Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Using today's git (I don't know when that issue appeared), the "-b" bitrate option in FFmpeg sets both video AND audio bitrate.

The FFmpeg documentation says:

  • To set the video bitrate of the output file to 64kbit/s:

ffmpeg -i input.avi -b 64k output.avi

However, in current git, trying for example:

ffmpeg -i sample.MTS -b 2000k test.mpg

Fails with the following error:
[mp2 @ 0x80cbb20] bitrate 2000 is not allowed in mp2

Trying:
ffmpeg -i sample.MTS -ab 128k -b 2000k test.mpg

Also fails because '-b' overrides '-ab', so the only solution is to do:

ffmpeg -i sample.MTS -b 2000k -ab 128k test.mpg

This seems a bug to me, it was not working that way before, and it breaks the encoding profiles that we use in our application (Kdenlive). If this change was made on purpose, the documentation should be updated.

Change History (4)

comment:1 by Carl Eugen Hoyos, 13 years ago

Complete, uncut output missing.

comment:2 by Jean-Baptiste Mardelle, 13 years ago

Sorry, here is the complete output:

ffmpeg -i 00006.MTS -b 2000k test.mpg
ffmpeg version N-32732-g7491816, Copyright (c) 2000-2011 the FFmpeg developers

built on Sep 20 2011 12:11:56 with gcc 4.6.1
configuration: --prefix=/usr --enable-shared --enable-libmp3lame --enable-gpl --enable-libfaac --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-x11grab --enable-libgsm --enable-libx264 --enable-libtheora --enable-libdc1394 --enable-nonfree --disable-stripping --enable-avfilter --enable-libschroedinger --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3
libavutil 51. 16. 1 / 51. 16. 1
libavcodec 53. 16. 0 / 53. 16. 0
libavformat 53. 12. 0 / 53. 12. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 43. 2 / 2. 43. 2
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0

[mpegts @ 0x99beac0] parser not found for codec hdmv_pgs_subtitle, packets or times may be invalid.

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 50.00 (50/1)
Input #0, mpegts, from '00006.MTS':

Duration: 00:00:34.15, start: 0.701789, bitrate: 15782 kb/s
Program 1

Stream #0.0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0.1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, s16, 192 kb/s
Stream #0.2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)

[buffer @ 0x99c61e0] w:1920 h:1080 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
[mp2 @ 0x99c65a0] bitrate 2000 is not allowed in mp2
Output #0, mpeg, to 'test.mpg':

Stream #0.0: Video: mpeg1video, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 90k tbn, 50 tbc
Stream #0.1: Audio: mp2, 48000 Hz, stereo, s16, 2000 kb/s

Stream mapping:

Stream #0.0 -> #0.0 (h264 -> mpeg1video)
Stream #0.1 -> #0.1 (ac3 -> mp2)

Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

comment:3 by Carl Eugen Hoyos, 13 years ago

Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

The correct option in this case is -vb (which works with older versions).

comment:4 by Carl Eugen Hoyos, 13 years ago

Resolution: fixed
Status: openclosed

Should be fixed, please reopen if not.

Note: See TracTickets for help on using tickets.