From e194585b1802b3d618e53ef1c8cd72cd237633b4 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Wed, 16 Jan 2019 10:25:47 -0800 Subject: [PATCH] muxavformat: use better approximation for duration of last video frame Fixes https://github.com/HandBrake/HandBrake/issues/1802 (cherry picked from commit 71e73fec08f414574c74dd0b482c516faad2fbfb) --- libhb/muxavformat.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c index 806620b69..c1d401fc3 100644 --- a/libhb/muxavformat.c +++ b/libhb/muxavformat.c @@ -1229,10 +1229,20 @@ static int avformatMux(hb_mux_object_t *m, hb_mux_data_t *track, hb_buffer_t *bu // have zero duration. if (track->type == MUX_TYPE_SUBTITLE && track->st->codecpar->codec_id != AV_CODEC_ID_HDMV_PGS_SUBTITLE) + { duration = av_rescale_q(10, (AVRational){1,1}, track->st->time_base); + } + else if (track->type == MUX_TYPE_VIDEO) + { + duration = av_rescale_q( + (int64_t)job->vrate.den * 90000 / job->vrate.num, + (AVRational){1,90000}, track->st->time_base); + } else + { duration = 0; + } } av_init_packet(&pkt); -- 2.40.0