[FFmpeg-devel] [PATCH] avformat/matroskaenc: use r_frame_rate as fallback to set a track's DefaultDuration

James Almer jamrial at gmail.com
Tue Oct 1 18:58:20 EEST 2019


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/matroskaenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a64ffdb690..37706e56c7 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -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) &&
-- 
2.22.0



More information about the ffmpeg-devel mailing list