[FFmpeg-devel] [PATCH] avutil/timecode: fix starting frame number for 59.94 fps

Gyan Doshi gyandoshi at gmail.com
Thu Feb 22 14:45:42 EET 2018


Couple of questions on SE report that the user-supplied timecode string 
was altered in the output when remuxing a MXF with 59.94 fps stream.

Turns out the code assumed a fixed 30 fps. Fixed in patch.

Regards,
Gyan
-------------- next part --------------
From b7e6ff948c46027c1af28f1b40e921fe6e76a4cc Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi at gmail.com>
Date: Thu, 22 Feb 2018 18:04:42 +0530
Subject: [PATCH] avutil/timecode: fix starting frame number for 59.94 fps

The existing code for adjusting starting frame number assumes 29.97 as
stream fps.
---
 libavutil/timecode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index e9d8504ee7..60077ba0c0 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -214,7 +214,7 @@ int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *st
     tc->start = (hh*3600 + mm*60 + ss) * tc->fps + ff;
     if (tc->flags & AV_TIMECODE_FLAG_DROPFRAME) { /* adjust frame number */
         int tmins = 60*hh + mm;
-        tc->start -= 2 * (tmins - tmins/10);
+        tc->start -= (tc->fps == 30 ? 2 : 4) * (tmins - tmins/10);
     }
     return 0;
 }
-- 
2.12.2.windows.2


More information about the ffmpeg-devel mailing list