Opened 6 years ago

Last modified 3 years ago

#6793 reopened defect

Timecode of mp4 file from Sony FDR-AX100 camera not recognized

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

Description

Steps to reproduce

$ ffprobe -show_format -show_streams C0001.MP4
ffprobe version N-88289-g783535a4cd Copyright (c) 2007-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.38)
  configuration: 
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  1.100 / 58.  1.100
  libavformat    58.  0.102 / 58.  0.102
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.101 /  7.  0.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.100 /  3.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C0001.MP4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 16785407
    compatible_brands: XAVCmp42iso2
    creation_time   : 2017-02-12T01:31:28.000000Z
  Duration: 00:00:49.05, start: 0.000000, bitrate: 97074 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/iec61966-2-4), 3840x2160 [SAR 1:1 DAR 16:9], 95289 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2017-02-12T01:31:28.000000Z
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2017-02-12T01:31:28.000000Z
      handler_name    : Sound Media Handler
    Stream #0:2(und): Data: none (rtmd / 0x646D7472), 245 kb/s (default)
    Metadata:
      creation_time   : 2017-02-12T01:31:28.000000Z
      handler_name    : Timed Metadata Media Handler
      timecode        : 83:01:01;02
Unsupported codec with id 0 for input stream 2
[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=1001/60000
codec_tag_string=avc1
codec_tag=0x31637661
width=3840
height=2160
coded_width=3840
coded_height=2160
has_b_frames=1
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=51
color_range=tv
color_space=bt709
color_transfer=iec61966-2-4
color_primaries=bt709
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=30000/1001
avg_frame_rate=30000/1001
time_base=1/30000
start_pts=2002
start_time=0.066733
duration_ts=1471470
duration=49.049000
bit_rate=95289969
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=1470
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2017-02-12T01:31:28.000000Z
TAG:language=und
TAG:handler_name=Video Media Handler
TAG:encoder=AVC Coding
[/STREAM]
[STREAM]
index=1
codec_name=pcm_s16be
codec_long_name=PCM signed 16-bit big-endian
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=twos
codec_tag=0x736f7774
sample_fmt=s16
sample_rate=48000
channels=2
channel_layout=unknown
bits_per_sample=16
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=2354352
duration=49.049000
bit_rate=1536000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=2354352
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2017-02-12T01:31:28.000000Z
TAG:language=und
TAG:handler_name=Sound Media Handler
[/STREAM]
[STREAM]
index=2
codec_name=unknown
codec_long_name=unknown
profile=unknown
codec_type=data
codec_tag_string=rtmd
codec_tag=0x646d7472
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/30000
start_pts=0
start_time=0.000000
duration_ts=1471470
duration=49.049000
bit_rate=245514
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=1470
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2017-02-12T01:31:28.000000Z
TAG:language=und
TAG:handler_name=Timed Metadata Media Handler
TAG:timecode=83:01:01;02
[/STREAM]
[FORMAT]
filename=C0001.MP4
nb_streams=3
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=49.049000
size=595175729
bit_rate=97074473
probe_score=100
TAG:major_brand=XAVC
TAG:minor_version=16785407
TAG:compatible_brands=XAVCmp42iso2
TAG:creation_time=2017-02-12T01:31:28.000000Z
[/FORMAT]

Sample file

http://50.19.4.114/bugs/ffmpeg/C0001.MP4 (caution: 568M)

Other info

This looks like https://trac.ffmpeg.org/ticket/5645, except that I've built from master (git://source.ffmpeg.org/ffmpeg.git) and see d693392 in my Git rev history, so I should already have that fix. Here's my revision of ffprobe (ffmpeg shows the same):

$ ffprobe -version
ffprobe version N-88289-g783535a4cd Copyright (c) 2007-2017 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.38)
configuration: 
libavutil      56.  0.100 / 56.  0.100
libavcodec     58.  1.100 / 58.  1.100
libavformat    58.  0.102 / 58.  0.102
libavdevice    58.  0.100 / 58.  0.100
libavfilter     7.  0.101 /  7.  0.101
libswscale      5.  0.101 /  5.  0.101
libswresample   3.  0.100 /  3.  0.100

Change History (11)

in reply to:  description comment:1 by Carl Eugen Hoyos, 6 years ago

Cc: Carl Eugen Hoyos removed
Keywords: mov timecode added

Replying to tvolkert:

TAG:timecode=83:01:01;02

Is this wrong?

comment:2 by tvolkert, 6 years ago

I don't know since I don't even know what data that stream holds...

However, I assume the file is valid, since it's unmodified from the camera. The file also plays fine, fwiw

comment:3 by tvolkert, 6 years ago

Incidentally, I noticed that I get this exact same error on a movie that was cut from two clips from these model video cameras -- edited and exported via FinalCutPro X (which had no problem with the clips)

$ ffprobe -show_format -show_streams clip.mov
ffprobe version N-88289-g783535a4cd Copyright (c) 2007-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.38)
  configuration: 
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  1.100 / 58.  1.100
  libavformat    58.  0.102 / 58.  0.102
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.101 /  7.  0.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.100 /  3.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'clip.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2017-02-21T06:52:10.000000Z
    com.apple.quicktime.keywords: <redacted>
    com.apple.quicktime.description: <redacted>
    com.apple.quicktime.author: <redacted>
    com.apple.quicktime.displayname: <redacted>
    com.apple.quicktime.title: <redacted>
  Duration: 00:02:32.15, start: 0.000000, bitrate: 62561 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 62266 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2017-02-21T06:52:11.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
      timecode        : 00:00:00:00
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2017-02-21T06:52:11.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:2(und): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2017-02-21T06:52:11.000000Z
      handler_name    : Core Media Data Handler
      timecode        : 00:00:00:00
Unsupported codec with id 0 for input stream 2
[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=1001/60000
codec_tag_string=avc1
codec_tag=0x31637661
width=3840
height=2160
coded_width=3840
coded_height=2160
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=51
color_range=tv
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=progressive
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=30000/1001
avg_frame_rate=30000/1001
time_base=1/30000
start_pts=0
start_time=0.000000
duration_ts=4564560
duration=152.152000
bit_rate=62266240
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=4560
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2017-02-21T06:52:11.000000Z
TAG:language=und
TAG:handler_name=Core Media Data Handler
TAG:encoder=H.264
TAG:timecode=00:00:00:00
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=7303296
duration=152.152000
bit_rate=125221
max_bit_rate=128000
bits_per_raw_sample=N/A
nb_frames=7135
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2017-02-21T06:52:11.000000Z
TAG:language=und
TAG:handler_name=Core Media Data Handler
[/STREAM]
[STREAM]
index=2
codec_name=unknown
codec_long_name=unknown
profile=unknown
codec_type=data
codec_tag_string=tmcd
codec_tag=0x64636d74
id=N/A
r_frame_rate=0/0
avg_frame_rate=30/1
time_base=1/30000
start_pts=0
start_time=0.000000
duration_ts=4564560
duration=152.152000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=1
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2017-02-21T06:52:11.000000Z
TAG:language=und
TAG:handler_name=Core Media Data Handler
TAG:timecode=00:00:00:00
[/STREAM]
[FORMAT]
filename=clip.mov
nb_streams=3
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=152.152000
size=1189858836
bit_rate=62561587
probe_score=100
TAG:major_brand=qt  
TAG:minor_version=0
TAG:compatible_brands=qt  
TAG:creation_time=2017-02-21T06:52:10.000000Z
TAG:com.apple.quicktime.keywords=<redacted>
TAG:com.apple.quicktime.description=<redacted>
TAG:com.apple.quicktime.author=<redacted>
TAG:com.apple.quicktime.displayname=<redacted>
TAG:com.apple.quicktime.title=<redacted>
[/FORMAT]

comment:4 by tvolkert, 6 years ago

In case it didn't stand out in comment:3, the timecode looks more sane in that file:

TAG:timecode=00:00:00:00

comment:5 by tvolkert, 6 years ago

Here's a smaller sample file:

http://50.19.4.114/bugs/ffmpeg/C0088.MP4 (51M)

I run into this problem with any files generated from that model camera (I've tried both my cameras). Any idea where the problem lies?

comment:6 by Carl Eugen Hoyos, 6 years ago

Your original report was that FFmpeg does not recognize the timecode for this camera but I see a timecode:

$ ffmpeg -i C0088.MP4
ffmpeg version N-88541-g3357b68 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  1.100 / 58.  1.100
  libavformat    58.  0.102 / 58.  0.102
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.101 /  7.  0.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3a10240] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1001
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3a10240] st: 0 edit list 1 Cannot find an index entry before timestamp: 1001.
Rounding edit list media time to zero.
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C0088.MP4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 16785407
    compatible_brands: XAVCmp42iso2
    creation_time   : 2017-11-04T23:25:24.000000Z
  Duration: 00:00:04.50, start: 0.000000, bitrate: 95011 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/iec61966-2-4), 3840x2160 [SAR 1:1 DAR 16:9], 93221 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2017-11-04T23:25:24.000000Z
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2017-11-04T23:25:24.000000Z
      handler_name    : Sound Media Handler
    Stream #0:2(und): Data: none (rtmd / 0x646D7472), 245 kb/s (default)
    Metadata:
      creation_time   : 2017-11-04T23:25:24.000000Z
      handler_name    : Timed Metadata Media Handler
      timecode        : 83:01:01;02
At least one output file must be specified

Is it wrong?
What is the correct timecode?

in reply to:  4 comment:7 by Balling, 3 years ago

Resolution: fixed
Status: newclosed

Replying to tvolkert:

In case it didn't stand out in comment:3, the timecode looks more sane in that file:

TAG:timecode=00:00:00:00

Those are different timecodes. You first one is as can be seen in d693392886b8454c818e384c816b9ede53c570d8 is for rtmd codec_tag, while your second is for tmcd tag.

Anyways, the samples are gone now. I suppose it is correct as that commit above also permits this:

drop ? ';' : ':'

for delimiter.

I suppose you can check in Adobe Premiere Pro as said in #5645.

comment:8 by Carl Eugen Hoyos, 3 years ago

Resolution: fixed
Status: closedreopened

I (still) don't understand this ticket but please only close it as fixed if you can point to the commit fixing it.

comment:9 by tvolkert, 3 years ago

FYI, the clip is still there - http://50.19.4.114/bugs/ffmpeg/, then manually save C0001.MP4

in reply to:  9 comment:10 by Balling, 3 years ago

Replying to tvolkert:

FYI, the clip is still there - http://50.19.4.114/bugs/ffmpeg/, then manually save C0001.MP4

Yeah, unfortunately you now no longer can save http files from https sites in Chrome. Sigh.

Will try to check in Premier.

I (still) don't understand this ticket but please only close it as fixed if you can point to the commit fixing it.

That is the commit above. You can read about more of this stuff here:
https://www.cinelerra-gg.org/bugtracker/view.php?id=448#c3793

"when the last value is separated by a semicolon vs. a colon. A semicolon signifies _drop-frame_ timecode"

Last edited 3 years ago by Balling (previous) (diff)

comment:11 by Balling, 3 years ago

There are some interesting samples as well here: https://forum.videohelp.com/threads/371906-XAVC-S-How-to-export-time-date-metadata-to-subtitles-%28srt%29 also with xvYCC extended gamut transfer. Nice.

I also suppose that the actual content of the data stream can be shown by this command

ffprobe -pretty -show_packets -select_streams d

or just by exiftool.exe -v -extractEmbedded (Meta Format: rtmd)

but there is also a much more interesting example of metadata here: https://github.com/SK-Hardwired/xavc_rtmd2srt/issues/1

And now we can see that those are actual tags: https://github.com/SK-Hardwired/xavc_rtmd2srt/blob/b8859063c84c258ccf3195ed9305694748973f17/rtmd2srt.py#L103

rtmd (SubDirectory) -->
+ [Sony rtmd directory, 1024 bytes]
| Sony_rtmd_0x060e = 6 14 43 52 2 83 1 1 12 2 1 1 1 1 0 0
| Sony_rtmd_0x8000 = 53367
| Sony_rtmd_0x8001 = 58244
| Sony_rtmd_0x060e = 6 14 43 52 2 83 1 1 12 2 1 1 2 1 0 0
| Sony_rtmd_0x8100 = 6 14 43 52 4 1 1 11 5 16 1 1 1 2 0 0
| Sony_rtmd_0x8101 = 1
| Sony_rtmd_0x8109 = 1 60
| Sony_rtmd_0x810a = 1200
| Sony_rtmd_0x810c = 100
| Sony_rtmd_0x810d = 1
| Sony_rtmd_0x060e = 6 14 43 52 2 83 1 1 12 2 1 1 127 1 0 0
| Sony_rtmd_0xe000 = 150 105 8 0 70 120 3 28 32 81 0 0 240 192 17 129
| Sony_rtmd_0xe300 = 0
| Sony_rtmd_0xe302 = 0
| Sony_rtmd_0xe303 = 255
| DateTime = n ....%$
SampleTime = 0.166833333333333
SampleDuration = 0.0333666666666667

Those are: 810d is AutoWhiteBalanceMode, 8101 is AutoFocusSensingAreaSetting, 8000 is IrisFNumber, 810a is CameraMasterGainAdjustment, etc. 0xE000: UDAM ID and 060e is mxf stuff.
Wow.

So from exiftool some info is here:
https://github.com/exiftool/exiftool/blob/d4e8e4caea1b575e7345062de62be24888b32987/lib/Image/ExifTool/QuickTimeStream.pl#L186

Note: See TracTickets for help on using tickets.