]> granicus.if.org Git - handbrake/commitdiff
muxavformat: use better approximation for duration of last video frame
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 16 Jan 2019 18:25:47 +0000 (10:25 -0800)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 16 Jan 2019 18:27:34 +0000 (10:27 -0800)
Fixes https://github.com/HandBrake/HandBrake/issues/1802

libhb/muxavformat.c

index ff041b47c6f2cd9a62f020f2a0ed4236d425fa9e..2d4390f53128b309ac9289631597d8313f6f86e9 100644 (file)
@@ -1234,10 +1234,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);