[Libav-user] [libavcodec] requested bitrate is too low, when using VBR qscale

Richard H Lee ricardohenrylee at gmail.com
Tue Jul 24 17:10:30 CEST 2012


(I'm not sure if this post belongs one of the other lists like 
ffmpeg-users, so please let me know if this is the wrong list.)

I'm trying to do basic VBR 2-pass mpeg4 encoding with ffmpeg. The sample 
file is the 480p Big Buck Bunny trailer 
http://download.blender.org/peach/trailer/trailer_480p.mov . My ffmpeg 
is built from git on Ubuntu 32.

The command line I use for 1st pass is:
ffmpeg -i trailer_480p.mov -vcodec mpeg4 -q:v 4 -pass 1 -an test.mp4

For second pass:
ffmpeg -i trailer_480p.mov -vcodec mpeg4 -q:v 4 -pass 2 -an test.mp4

You can see the stdout output at the bottom on this email.

The error I get is:
requested bitrate is too low

This stems from ratecontrol.c:
     if(all_available_bits < all_const_bits){
         av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is too low\n");
         return -1;
     }

I think all_const_bits is obtained by summing over the rate control data 
in the log file.
all_availiable_bits is calculated using:
uint64_t all_available_bits= 
(uint64_t)(s->bit_rate*(double)rcc->num_entries/fps);

I breakpointed at the error message and found that s->bit_rate was the 
default at 200 . Compare this to bitrate of test.mp4 after the first 
pass which is ~1700 - 2000 . This is the reason why all_available_bits < 
all_const_bits .

I'm pretty I don't need to set bitrate as I'm doing VBR encoding. But 
what needs to be done to pass the "correct" bitrate to libavcodec?

[This also occurs with divverent's encoding branch mplayer2. 
Additionally when I try to do 2-pass CBR encoding with ffmpeg, I get a 
segfault as pict_type is a huge number when it is meant to be 1<4 for 
the index of an array.]


Richard

==========

1st pass stdout:

ffmpeg version N-42847-gdc31b84 Copyright (c) 2000-2012 the FFmpeg 
developers
   built on Jul 24 2012 01:33:10 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
   configuration: --enable-debug --disable-stripping
   libavutil      51. 65.100 / 51. 65.100
   libavcodec     54. 44.100 / 54. 44.100
   libavformat    54. 20.100 / 54. 20.100
   libavdevice    54.  2.100 / 54.  2.100
   libavfilter     3.  3.100 /  3.  3.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 15.100 /  0. 15.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'trailer_480p.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 537199360
     compatible_brands: qt
     creation_time   : 1938-02-11 06:16:36
   Duration: 00:00:32.99, start: 0.000000, bitrate: 2681 kb/s
     Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 
854x480, 2282 kb/s, 25 fps, 25 tbr, 600 tbn, 1200 tbc
     Metadata:
       creation_time   : 1938-02-11 06:16:36
       handler_name    : Apple Alias Data Handler
     Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, 
s16, 428 kb/s
     Metadata:
       creation_time   : 1938-02-11 06:16:36
       handler_name    : Apple Alias Data Handler


2nd pass stdout:

ffmpeg version N-42847-gdc31b84 Copyright (c) 2000-2012 the FFmpeg 
developers
   built on Jul 24 2012 01:33:10 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
   configuration: --enable-debug --disable-stripping
   libavutil      51. 65.100 / 51. 65.100
   libavcodec     54. 44.100 / 54. 44.100
   libavformat    54. 20.100 / 54. 20.100
   libavdevice    54.  2.100 / 54.  2.100
   libavfilter     3.  3.100 /  3.  3.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 15.100 /  0. 15.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'trailer_480p.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 537199360
     compatible_brands: qt
     creation_time   : 1938-02-11 06:16:36
   Duration: 00:00:32.99, start: 0.000000, bitrate: 2681 kb/s
     Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 
854x480, 2282 kb/s, 25 fps, 25 tbr, 600 tbn, 1200 tbc
     Metadata:
       creation_time   : 1938-02-11 06:16:36
       handler_name    : Apple Alias Data Handler
     Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, 
s16, 428 kb/s
     Metadata:
       creation_time   : 1938-02-11 06:16:36
       handler_name    : Apple Alias Data Handler
File 'test.mp4' already exists. Overwrite ? [y/N] y
requested bitrate is too low
Output #0, mp4, to 'test.mp4':
   Metadata:
     major_brand     : qt
     minor_version   : 537199360
     compatible_brands: qt
     Stream #0:0(eng): Video: mpeg4, yuv420p, 854x480, q=2-31, pass 2, 
200 kb/s, 90k tbn, 25 tbc
     Metadata:
       creation_time   : 1938-02-11 06:16:36
       handler_name    : Apple Alias Data Handler
Stream mapping:
   Stream #0:0 -> #0:0 (h264 -> mpeg4)
Error while opening encoder for output stream #0:0 - maybe incorrect 
parameters such as bit_rate, rate, width or height


More information about the Libav-user mailing list