[FFmpeg-devel] [PATCH 4/4] movenc: fix muxing of timecode tracks

Jean First jeanfirst at gmail.com
Sat Aug 25 11:44:14 CEST 2012


fixes ticket #236

Signed-off-by: Jean First <jeanfirst at gmail.com>
---
Multiplying the timebase.den looks hackish, but I don't know how to get the correct values. See
"Creating Video Tracks at 30 Frames per Second" and the surrounding chapters on
http://developer.apple.com/library/mac/#documentation/QuickTime/qtff/QTFFChap5/qtff5.html

Maybe someone has a better idea.

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

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index aa055ee..12ceccc 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1091,7 +1091,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
 static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track)
 {
     int64_t pos = avio_tell(pb);
-    int frame_duration = track->enc->time_base.num;
+    int frame_duration = track->enc->time_base.num * 100;
     int nb_frames = (track->timescale + frame_duration/2) / frame_duration;
 
     avio_wb32(pb, 0); /* size */
@@ -2234,6 +2234,10 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
             MOVTrack *src_track = &mov->tracks[mov->tracks[i].src_track];
             src_track->tref_tag = mov->tracks[i].tag;
             mov->tracks[i].track_duration = src_track->track_duration;
+            if (src_track->timescale == 2997){
+                av_log(mov,AV_LOG_WARNING,"timecode track: %d, assuming drop frame timecode\n",i);
+                mov->tracks[i].timecode_flags |= MOV_TIMECODE_FLAG_DROPFRAME;
+            }
             src_track->tref_count++;
             src_track->tref_ids = av_realloc(src_track->tref_ids,
                     src_track->tref_count * sizeof(*src_track->tref_ids));
-- 
1.7.9.4



More information about the ffmpeg-devel mailing list