[Libav-user] encoding bitrate wrong

mattes effemm at mykmk.com
Thu Mar 1 19:08:55 CET 2012


> 2012/3/1 mattes <effemm at mykmk.com>:
>> I ported an older mp4 encoder application (using ffmpeg 0.4.9 libs)  over to the ffmpeg 0.7.11 (on
Fedora15).
>> Encoding is working, but there is one minor glitch.
>>   Bitrate is set via AVContext->bit_rate = bitrate.
>
> Which video codec do you use?
> Do you have audio tracks? Did you try encoding without audio tracks? How much bitrate differs from
desired, without audio tracks?
> 1. Ensure that frames you feed to encoder have timestamps in that AVCodecContext's time_base. 2. If
that doesn't help, try setting also AVCodecContext.rc_max_rate to bitrate, and .rc_buffer_size
(try also bitrate value, as trial value). This possibly makes sense only if libx264 encoder is used.
Andrey Utkin

The video codec used is CODEC_ID_MPEG4
with one audio track and codec  AAC - FAAC

  video bitrate   audio bitrate  resulting bitrate
   500            128            12614
  1500            128            237
  2500            128            13355

I did some test runs w/o audio and the results are similiar:

  video bitrate  abr    resulting bitrate
   500           -      16377
  1500           -      105
  2500           -      14895


ffmpeg -i ffm_videoonly_500.mp4
   Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2012-03-01 16:57:16
    encoder         : mp4live version 1.6.2
  Duration: 00:00:59.96, start: 0.000000, bitrate: 16378 kb/s
    Stream #0.0(eng): Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 16377 kb/s, 29.97 fps, 30 tbr,
90k tbn, 30 tbc

ffmpeg -i ffm_videoonly_1500.mp4
  Duration: 00:00:59.96, start: 0.000000, bitrate: 107 kb/s
    Stream #0.0(eng): Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 105 kb/s, 29.97 fps, 30 tbr, 90k
tbn, 30 tbc

ffmpeg -i ffm_videoonly_2500.mp4
  Duration: 00:00:59.96, start: 0.000000, bitrate: 14897 kb/s
    Stream #0.0(eng): Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 14895 kb/s, 29.97 fps, 30 tbr,
90k tbn, 30 tbc



I will look into 1) and 2)
thanx





More information about the Libav-user mailing list