GNOME Bugzilla – Bug 575736
mpeg2enc's bitrate parameter does not work properly
Last modified: 2009-03-30 20:11:12 UTC
I attempted to reencode a 15-minute sample video using mpeg2enc. I picked bitrate=3180 since the CableLabs VOD standard specifies 3180000 bits/s. When I graphed the bit rate of the resulting stream the results were drastically wrong. It started out good, but after a few seconds exploded to 15Mbits/s with spikes to 27Mbit/s. I experimented with varying bit rates. 2750 Kbits/s worked for the entire 15-minute encoding. 2900 exploded near the end. 3000-3050 exploded in the middle, went sane later on, and exploded again at the end. gst-launch-0.10 -v filesrc location=/var/tmp/The\ Drinky\ Crow\ Show\ -\ Tunnel\ Girls.mpeg ! decodebin name=db ! queue ! videoscale ! video/x-raw-yuv, width=352, height=480, pixel-aspect-ratio=1920/1056 ! mpeg2enc b-per-refframe=2 bitrate=2900 min-gop-size=15 max-gop-size=15 sequence-header-every-gop=true aspect=2 ! ttvpeswrapper silent=true ! filesink location=/var/tmp/x/dc.m2v db.! queue ! audioconvert ! ffenc_ac3 bitrate=192000 ! ttvpeswrapper silent=true stream-id=189 ! filesink location=/var/tmp/x/dc.ac3 I have a screenshot of one of the graphs here: http://www.purplefrog.com/~thoth/x/bitrate=3050.png
I also noticed that the bitrate parameter does not use 1000bit kilobits, but instead uses 1024bit kilobits. This is different from the conventions used in the broadcast industry and in the underlying standards documents. mpeg2enc should probably use the same conventions as the relevant standards.
mpeg2enc's rate control is rumoured to be fixed/improved in 1.9, but no warranty on that here. On the other hand, the following takes care of some bitrate property setting: commit d2f954636997b16343b40dfefd3ffb0fb00895a1 Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> Date: Mon Mar 30 21:57:12 2009 +0200 mpeg2enc: fix bitrate property settings Align bitrate property interpretation with usual mpeg2enc behaviour. Fixes #575736.