Opened 10 years ago

Closed 10 years ago

#3453 closed defect (fixed)

Mov timecode track duration incorrect

Reported by: Bryce McLeod Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: mov tmcd
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

When muxing mov files containing a timecode track the duration of the timecode stream on the output is wrong, differences in the timescale between video and timecode are not accounted for.

The example file is a minute long and has a timecode track (note the duration of the video and timecode tracks are the same)

 ffprobe -show_streams -print_format xml mov_with_tmcd.mov 2>/dev/null
<?xml version="1.0" encoding="UTF-8"?>
<ffprobe>
    <streams>
        <stream index="0" codec_name="h264" codec_long_name="H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10" profile="High" codec_type="video" codec_time_base="1/50" codec_tag_string="avc1" codec_tag="0x31637661" width="720" height="576" has_b_frames="2" sample_aspect_ratio="0:1" display_aspect_ratio="0:1" pix_fmt="yuv420p" level="30" r_frame_rate="25/1" avg_frame_rate="25/1" time_base="1/25" start_pts="0" start_time="0.000000" duration_ts="1502" duration="60.080000" bit_rate="81100" nb_frames="1502">
            <disposition default="1" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0"/>
            <tag key="language" value="eng"/>
            <tag key="handler_name" value="DataHandler"/>
            <tag key="timecode" value="00:00:00:00"/>
        </stream>
        <stream index="1" codec_name="pcm_s16le" codec_long_name="PCM signed 16-bit little-endian" codec_type="audio" codec_time_base="1/48000" codec_tag_string="sowt" codec_tag="0x74776f73" sample_fmt="s16" sample_rate="48000" channels="2" channel_layout="stereo" bits_per_sample="16" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/48000" start_pts="0" start_time="0.000000" duration_ts="2880000" duration="60.000000" bit_rate="1536000" nb_frames="2880000">
            <disposition default="1" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0"/>
            <tag key="language" value="eng"/>
            <tag key="handler_name" value="DataHandler"/>
        </stream>
        <stream index="2" codec_type="data" codec_time_base="1/25" codec_tag_string="tmcd" codec_tag="0x64636d74" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/25" start_pts="0" start_time="0.000000" duration_ts="1502" duration="60.080000" bit_rate="798" nb_frames="1500">
            <disposition default="0" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0"/>
            <tag key="language" value="eng"/>
            <tag key="handler_name" value="DataHandler"/>
            <tag key="timecode" value="00:00:00:00"/>
        </stream>
    </streams>
</ffprobe>

The file is remuxed using ffmpeg

 ffmpeg -report -i mov_with_tmcd.mov -vcodec copy -acodec copy -dcodec copy -map 0:v -map 0:a -map 0:d out_git_head.mov
ffmpeg started on 2014-03-12 at 09:19:43
Report written to "ffmpeg-20140312-091943.log"
ffmpeg version N-61313-g1f36ebf Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar 12 2014 09:16:27 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --enable-swscale --enable-avfilter --enable-avresample --enable-postproc --enable-libmp3lame --enable-libopenjpeg --enable-libbluray --enable-libx264 --enable-libfaac --enable-gpl --enable-version3 --enable-nonfree --enable-gnutls --enable-pthreads --arch=x86_64 --enable-yasm --enable-optimizations --disable-static --enable-shared --extra-cxxflags='"-fPIC"' --extra-cflags='"-march=native"'
  libavutil      52. 66.101 / 52. 66.101
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 34.100 / 55. 34.100
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libavresample   1.  2.  0 /  1.  2.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mov_with_tmcd.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf55.34.100
  Duration: 00:01:00.08, start: 0.000000, bitrate: 1626 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576, 81 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
    Metadata:
      handler_name    : DataHandler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      handler_name    : DataHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      handler_name    : DataHandler
      timecode        : 00:00:00:00
[mov @ 0x10b30c0] You requested a copy of the original timecode track so timecode metadata are now ignored
Output #0, mov, to 'out_git_head.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf55.34.100
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 720x576, q=2-31, 81 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : DataHandler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, 1536 kb/s (default)
    Metadata:
      handler_name    : DataHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      handler_name    : DataHandler
      timecode        : 00:00:00:00
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame= 1502 fps=0.0 q=-1.0 Lsize=   11929kB time=00:01:00.00 bitrate=1628.7kbits/s
video:595kB audio:11250kB subtitle:0 data:6 global headers:0kB muxing overhead 0.658521%

The duration of the timecode stream in the output is 30760.960000 (8h 32mn)

ffprobe -show_streams -print_format xml out_git_head.mov 2>/dev/null
<?xml version="1.0" encoding="UTF-8"?>
<ffprobe>
    <streams>
        <stream index="0" codec_name="h264" codec_long_name="H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10" profile="High" codec_type="video" codec_time_base="1/50" codec_tag_string="avc1" codec_tag="0x31637661" width="720" height="576" has_b_frames="2" sample_aspect_ratio="0:1" display_aspect_ratio="0:1" pix_fmt="yuv420p" level="30" r_frame_rate="25/1" avg_frame_rate="25/1" time_base="1/12800" start_pts="0" start_time="0.000000" duration_ts="769024" duration="60.080000" bit_rate="81100" nb_frames="1502">
            <disposition default="1" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0"/>
            <tag key="language" value="eng"/>
            <tag key="handler_name" value="DataHandler"/>
            <tag key="timecode" value="00:00:00:00"/>
        </stream>
        <stream index="1" codec_name="pcm_s16le" codec_long_name="PCM signed 16-bit little-endian" codec_type="audio" codec_time_base="1/48000" codec_tag_string="sowt" codec_tag="0x74776f73" sample_fmt="s16" sample_rate="48000" channels="2" channel_layout="stereo" bits_per_sample="16" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/48000" start_pts="0" start_time="0.000000" duration_ts="2880000" duration="60.000000" bit_rate="1536000" nb_frames="2880000">
            <disposition default="1" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0"/>
            <tag key="language" value="eng"/>
            <tag key="handler_name" value="DataHandler"/>
        </stream>
        <stream index="2" codec_type="data" codec_time_base="1/25" codec_tag_string="tmcd" codec_tag="0x64636d74" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/25" start_pts="0" start_time="0.000000" duration_ts="769024" duration="30760.960000" bit_rate="800" nb_frames="1500">
            <disposition default="0" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0"/>
            <tag key="language" value="eng"/>
            <tag key="handler_name" value="DataHandler"/>
            <tag key="timecode" value="00:00:00:00"/>
        </stream>
    </streams>
</ffprobe>

If the input file has the same timebase on the video and data tracks then this issue can be worked around using the -video_track_timescale option for movenc

Attachments (1)

ffmpeg-20140312-091943.log (5.6 KB ) - added by Bryce McLeod 10 years ago.

Download all attachments as: .zip

Change History (2)

by Bryce McLeod, 10 years ago

Attachment: ffmpeg-20140312-091943.log added

comment:1 by Michael Niedermayer, 10 years ago

Reproduced by developer: set
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.