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

Clément Bœsch ubitux at gmail.com
Sat Aug 25 17:17:15 CEST 2012


On Sat, Aug 25, 2012 at 11:44:14AM +0200, Jean First wrote:
> 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.
> 

Looks weird; check aca0f78114a4f74e1b59d706c11c1bd5ff6f92d9 maybe, and the
related sample: http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket1576/

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

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120825/265caf54/attachment.asc>


More information about the ffmpeg-devel mailing list