diff mbox

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

Message ID a34bf492-c821-59df-03a9-932a27d1703a@gmail.com
State Accepted
Commit b6652f5100af48141dadcc45b087cf75eadc145e
Headers show

Commit Message

Gyan Feb. 22, 2018, 12:45 p.m. UTC
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
From b7e6ff948c46027c1af28f1b40e921fe6e76a4cc Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi@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(-)

Comments

Michael Niedermayer Feb. 23, 2018, 12:40 a.m. UTC | #1
On Thu, Feb 22, 2018 at 06:15:42PM +0530, Gyan Doshi wrote:
> 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

>  timecode.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 315e9c4d325ef9fc54ba4d76b9cfaa3b1c8996b3  0001-avutil-timecode-fix-starting-frame-number-for-59.94-.patch
> From b7e6ff948c46027c1af28f1b40e921fe6e76a4cc Mon Sep 17 00:00:00 2001
> From: Gyan Doshi <gyandoshi@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(-)

will apply

thx

[...]
diff mbox

Patch

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;
 }