[FFmpeg-devel] Subject: [PATCH] movenc, rescale when copying duration to timecode track

Bryce McLeod bryce.mcleod at codory.com
Wed Mar 12 11:10:30 CET 2014


Hi,
The following fixes the incorrect timecode track duration behaviour
observed in ticket #3453

Regards

Bryce McLeod

---
 libavformat/movenc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e21c32a..e906369 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2502,7 +2502,10 @@ static int mov_write_moov_tag(AVIOContext *pb,
MOVMuxContext *mov,
             int src_trk = mov->tracks[i].src_track;
             mov->tracks[src_trk].tref_tag = mov->tracks[i].tag;
             mov->tracks[src_trk].tref_id  = mov->tracks[i].track_id;
-            mov->tracks[i].track_duration =
mov->tracks[src_trk].track_duration;
+            //src_trk may have a different timescale than the tmcd track
+            mov->tracks[i].track_duration =
av_rescale(mov->tracks[src_trk].track_duration,
+
mov->tracks[i].timescale,
+
mov->tracks[src_trk].timescale);
         }
     }

-- 
1.8.3.2


More information about the ffmpeg-devel mailing list