diff options
author | John Stebbins <[email protected]> | 2019-01-18 12:19:14 -0800 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-01-18 12:21:15 -0800 |
commit | 0917684f5e3241a41e1b3fd26fca227073268f21 (patch) | |
tree | 2e920e08d43cbd8c33edb801cb70d7a152c58bc1 /libhb/encavcodec.c | |
parent | ad67818fe9ffe673a2a3e2ceb3404aa18a358f79 (diff) |
encavcodec: improve comment about ffmpeg timestamp handling
Diffstat (limited to 'libhb/encavcodec.c')
-rw-r--r-- | libhb/encavcodec.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index 01dcd8c70..8d8ad8b06 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -883,15 +883,23 @@ static void Encode( hb_work_object_t *w, hb_buffer_t *in, // doesn't do the trick. It must be set in the AVFrame. frame.quality = pv->context->global_quality; - // Remember info about this frame that we need to pass across - // the avcodec_encode_video call (since it reorders frames). + // Bizarro ffmpeg requires timestamp time_base to be == framerate + // for the encoders we care about. It writes AVCodecContext.time_base + // to the framerate field of encoded bitstream headers, so if we + // want correct bitstreams, we must set time_base = framerate. + // We can't pass timestamps that are not based on the time_base + // because encoders require accurately based timestamps in order to + // do proper rate control. + // + // I.e. ffmpeg doesn't support VFR timestamps. + // + // Because of this, we have to do some fugly things, like storing + // PTS values and computing DTS ourselves. + // + // Remember timestamp info about this frame save_frame_info(pv, in); compute_dts_offset(pv, in); - // Bizarro ffmpeg appears to require the input AVFrame.pts to be - // set to a frame number. Setting it to an actual pts causes - // jerky video. - // frame->pts = in->s.start; frame.pts = pv->frameno_in++; // Encode |