avvidenc: avenc_mpeg4 does not respect bitrate as of 1.18 branch
I found that bitrate of encoded video isn't correct in 1.18. It appears to be correct in 1.16.
steps to reproduce:
gst-launch-1.0 -ev videotestsrc num-buffers=1000 ! avenc_mpeg4 bitrate=200000 ! mp4mux ! filesink location=/tmp/video.mp4
Upon completion playback in vlc shows statistics which are about 2mbps regardless of bitrate value with 1.18, where as 1.16 creates expected bitrate.
I traced the issue to this line in ffmpeg: https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/ratecontrol.c#L926
it appears as though ffmpeg assumes the pts starts at zero as it is computing the total allowed bits for the video (bitrate * pts / fps). Since gstreamer is using the segment(?) timestamp it starts at 1000(hours?) it allows a lot of bits to be used.
I found that reverting 06c249ca returned to the 1.16 behavior.
Tagging: @ndufresne - thanks for your help on irc, curious if you have thoughts on this? I think my issue is solved with the revert patch. At lease so far. @meh - Mathieu it was your commit originally. Perhaps you have time to review.