Opened 17 months ago

Last modified 17 months ago

#5978 new defect

FFprobe calculates timecode wrong with mp4 ntsc framerates

Reported by: haze.ortner Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: timecode mov
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Trying to extract timecode from a .mp4 file with a timecode track produced by the standard apple describes here.
FFprobe calculates the timecode wrong, and the drift get greater in later hours.

This problem appears on NTSC framerates only.
Correct timecode at first frame should be 00:02:58:19
How to reproduce:

ffprobe started on 2016-11-24 at 17:22:41
Report written to "ffprobe-20161124-172241.log"
Command line:
"Q:\\Tools\\Reaper\\ffmpeg\\bin\\ffprobe.exe" -show_streams -of json -report "E:\\SyncTest\\Haze_synctest_60fps_2997TC_v3.MP4"
ffprobe version N-82324-g872b358 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 36.100 / 55. 36.100
  libavcodec     57. 66.101 / 57. 66.101
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 66.100 /  6. 66.100
  libswscale      4.  3.100 /  4.  3.100
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[file @ 0000000002633d40] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] ISO: File Type Major Brand: mp41
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Unknown dref type 0x0873696c61 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Processing st: 0, edit list 0 - media time: 0, duration: 972972
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Unknown dref type 0x0873696c61 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Unknown dref type 0x0873696c61 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Unknown dref type 0x0873696c61 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Using non-standard frame rate 59/1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Before avformat_find_stream_info() pos: 61187446 bytes read:96304 seeks:3 nb_streams:4
[h264 @ 0000000002644d60] nal_unit_type: 7, nal_ref_idc: 1
[h264 @ 0000000002644d60] nal_unit_type: 8, nal_ref_idc: 1
[h264 @ 0000000002644d60] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 0000000002644d60] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0000000002644d60] nal_unit_type: 5, nal_ref_idc: 1
[h264 @ 0000000002644d60] ct_type:1 pic_struct:0
[h264 @ 0000000002644d60] Reinit context to 1920x1088, pix_fmt: yuvj420p
[h264 @ 0000000002644d60] no picture 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] Non-increasing DTS in stream 3: packet 2 with DTS 0, packet 3 with DTS 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002633640] After avformat_find_stream_info() pos: 340240 bytes read:468907 seeks:4 frames:7
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'E:\SyncTest\Haze_synctest_60fps_2997TC_v3.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2015-01-03T00:02:58.000000Z
    firmware        : HD4.01.05.00.00
  Duration: 00:00:16.23, start: 0.000000, bitrate: 30151 kb/s
    Stream #0:0(eng), 1, 1/60000: Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 30028 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 00:03:01:42
    Stream #0:1(eng), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro AAC
      timecode        : 00:03:01:42
    Stream #0:2(eng), 1, 1/60000: Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro TCD
      timecode        : 00:03:01:42
    Stream #0:3(eng), 4, 1/60000: Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro SOS
[h264 @ 000000000071e360] nal_unit_type: 7, nal_ref_idc: 1
[h264 @ 000000000071e360] nal_unit_type: 8, nal_ref_idc: 1
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3
[AVIOContext @ 000000000263bf20] Statistics: 468907 bytes read, 4 seeks

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

Change History (9)

comment:1 Changed 17 months ago by haze.ortner

comment:2 follow-ups: Changed 17 months ago by cehoyos

  • Keywords mov added; mp4 ffprobe removed
  • Priority changed from important to normal

Do you think this is a regression?
Is the issue only reproducible with ffprobe or also with ffmpeg?

comment:3 in reply to: ↑ 2 Changed 17 months ago by haze.ortner

Replying to cehoyos:

Do you think this is a regression?
Is the issue only reproducible with ffprobe or also with ffmpeg?

I don't know what you mean with regression?
Same results using ffmpeg -i:

MacBook-Pro:~ Ortner$ /Users/Ortner/Downloads/ffmpeg -i /Users/Ortner/Dropbox/Haze_synctest_60fps_2997TC_v3.MP4 
ffmpeg version N-82622-g42ae9c6-tessus Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.107 / 57. 66.107
  libavformat    57. 58.100 / 57. 58.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ff0b1008600] Using non-standard frame rate 59/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Ortner/Dropbox/Haze_synctest_60fps_2997TC_v3.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2015-01-03T00:02:58.000000Z
    firmware        : HD4.01.05.00.00
  Duration: 00:00:16.23, start: 0.000000, bitrate: 30151 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 30028 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 00:03:01:42
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro AAC
      timecode        : 00:03:01:42
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro TCD
      timecode        : 00:03:01:42
    Stream #0:3(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro SOS
At least one output file must be specified

comment:4 in reply to: ↑ 2 Changed 17 months ago by haze.ortner

Replying to cehoyos:

Do you think this is a regression?
Is the issue only reproducible with ffprobe or also with ffmpeg?

I don't know what you mean with regression?
Same results using ffmpeg -i:

MacBook-Pro:~ Ortner$ /Users/Ortner/Downloads/ffmpeg -i /Users/Ortner/Dropbox/Haze_synctest_60fps_2997TC_v3.MP4 
ffmpeg version N-82622-g42ae9c6-tessus Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.107 / 57. 66.107
  libavformat    57. 58.100 / 57. 58.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ff0b1008600] Using non-standard frame rate 59/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Ortner/Dropbox/Haze_synctest_60fps_2997TC_v3.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2015-01-03T00:02:58.000000Z
    firmware        : HD4.01.05.00.00
  Duration: 00:00:16.23, start: 0.000000, bitrate: 30151 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 30028 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 00:03:01:42
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro AAC
      timecode        : 00:03:01:42
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro TCD
      timecode        : 00:03:01:42
    Stream #0:3(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2015-01-03T00:02:58.000000Z
      handler_name    : 	GoPro SOS
At least one output file must be specified

comment:5 in reply to: ↑ description ; follow-up: Changed 17 months ago by cehoyos

  • Component changed from ffprobe to avformat

Replying to haze.ortner:

This problem appears on NTSC framerates only.

But the timecode framerate of 59 is not NTSC.

Correct timecode at first frame should be 00:02:58:19

It would be 2:58 if the timecode framerate were 60 instead of 59.

Changed 17 months ago by cehoyos

comment:6 in reply to: ↑ 5 ; follow-up: Changed 17 months ago by haze.ortner

Replying to cehoyos:

It would be 2:58 if the timecode framerate were 60 instead of 59.

I see, the file is straight from a gopro camera using this gear:
Timecode Systems Syncbac

FCXP, Adobe Premiere CC and Vegas reads the timecode right. Vegas can be off by a frame sometimes.

If you shoot in 60fps on the gopro, the syncbac uses 29.97 ND for timecode.

I have more test files if that helps?

comment:7 in reply to: ↑ 6 ; follow-up: Changed 17 months ago by cehoyos

Replying to haze.ortner:

Replying to cehoyos:

It would be 2:58 if the timecode framerate were 60 instead of 59.

I see, the file is straight from a gopro camera using this gear:
Timecode Systems Syncbac

FCXP, Adobe Premiere CC and Vegas reads the timecode right. Vegas can be off by a frame sometimes.

How can we rule out that they all read the timecode wrong?

If you shoot in 60fps on the gopro, the syncbac uses 29.97 ND for timecode.

I have more test files if that helps?

Files with other timecode framerates may help.

comment:8 in reply to: ↑ 7 Changed 17 months ago by haze.ortner

Replying to cehoyos:

How can we rule out that they all read the timecode wrong?

I did a spreadsheet with 4 different test files and synced them manually against the audio that I recorded with a SoundDevices? 633 which was on the same clock. Then I noted the data, and most times they were straight on or of by a frame. And since I filmed the actual timecode I can see that those programs shows the same timecode that's in the picture.

Files with other timecode framerates may help.

Haze_synctest_25fps_25TC.MP4
Haze_synctest_30fps_2997TC.MP4
Haze_synctest_50fps_25TC.MP4

Note: See TracTickets for help on using tickets.