avformat/matroskaenc: use r_frame_rate as fallback to set a track's DefaultDuration
authorJames Almer <jamrial@gmail.com>
Tue, 1 Oct 2019 15:58:20 +0000 (12:58 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 6 Oct 2019 16:44:52 +0000 (13:44 -0300)
Signed-off-by: James Almer <jamrial@gmail.com>
libavformat/matroskaenc.c

index a64ffdb..37706e5 100644 (file)
@@ -1311,6 +1311,9 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
         if(   st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0
            && av_cmp_q(av_inv_q(st->avg_frame_rate), st->time_base) > 0)
             put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 1000000000LL * st->avg_frame_rate.den / st->avg_frame_rate.num);
+        else if(   st->r_frame_rate.num > 0 && st->r_frame_rate.den > 0
+                && av_cmp_q(av_inv_q(st->r_frame_rate), st->time_base) > 0)
+            put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 1000000000LL * st->r_frame_rate.den / st->r_frame_rate.num);
 
         if (!native_id &&
             ff_codec_get_tag(ff_codec_movvideo_tags, par->codec_id) &&