This is a new issue that came up with the #43 fix:
The selected bitrate is not properly respected, resulting files with a 1MBit rate end up between 900KBit (would be OK) and 5MBit (far too large), depending on the source. If transcoded from high bitrates, e.g. blurays, the resulting file's rate will also be higher.
We need to set the pts for the decoded/resized frames before they are fed to encoder. The person who found the solution has gone through ffmpeg.c source and was able to figure this out. We need to first rescale the AVFrame's pts from the stream's time_base to the codec time_base to get a simple frame number (e.g. 1, 2, 3).
And when we receive back the encoded packet from the libx264 codec, we need to rescale the pts and dts of the encoded video packet to the stream time base
This is a new issue that came up with the #43 fix:
The selected bitrate is not properly respected, resulting files with a 1MBit rate end up between 900KBit (would be OK) and 5MBit (far too large), depending on the source. If transcoded from high bitrates, e.g. blurays, the resulting file's rate will also be higher.
This seems to be a known problem, see https://stackoverflow.com/questions/11466184/setting-video-bit-rate-through-ffmpeg-api-is-ignored-for-libx264-codec. A possible fix is mentioned in the answer:
This fix is currently being evaluated. That's a FFmpeg API bug, if you ask me. But we'll have to bear with it anyway.