[FFmpeg-user] trouble shooting timecode issue with vfr mov

Dave Rice dave at dericed.com
Wed Nov 28 09:24:58 CET 2012


Hi all,

I have a discrepancy with the timecode copying in some cases. To make manageable sample files I'm replicating the issue with a short two frame video. The input file is a capture made with Final Cut from tape. From some (dumb) reason, FCP chooses to regularly make the first frame (and sometime last) have frame durations different than the rest. In this particular case the first frame has a sampDur of 401 (in the 'stts' sample-to-time atom) and the rest have '100'). When I open this in QuickTime I can navigate to each of the two frames and the timecodes are 00:59:14;24 and 00:59:14;25.

If I do: ffmpeg -vsync 0 -i fcp_capture.mov -map 0:v -map 0:a -c:v ffv1 -c:a copy throughffmpeg.mov
then I get: [mov @ 0x7fb451087a00] Drop frame is only allowed with 30000/1001 FPS

If I do (output below): ffmpeg -vsync 0 -i fcp_capture.mov -map 0:v -map 0:a -c:v ffv1 -r:v ntsc -c:a copy throughffmpeg.mov

then the output is produced and has two frames, but the timecode jumps from 00:59:14;24 to 00:59:14;28. I suppose this is to compensate for the 4x duration of the first frame, but then Quicktime calls the second frame of the source file 00:59:14;25 and the second frame of the output file 00:59:14;28. When transcoding material from Final Cut captures and trying to preserve the timecode, the timecode values are regularly three or four frames off from the source.

Here is my input file: http://dericed.com/samples/fcp_capture.mov and output from the command below: http://dericed.com/samples/throughffmpeg.mov.

Here is my output from the last reference command:

ffmpeg -y -vsync 0 -i fcp_capture.mov -map 0:v -map 0:a -c:v ffv1 -r:v ntsc -c:a copy throughffmpeg.mov
ffmpeg version 1.0.git Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 28 2012 01:52:19 with Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-ffplay --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 '
  libavutil      52.  9.102 / 52.  9.102
  libavcodec     54. 77.100 / 54. 77.100
  libavformat    54. 38.100 / 54. 38.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.104 /  3. 23.104
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
Guessed Channel Layout for  Input Stream #0.2 : stereo
Guessed Channel Layout for  Input Stream #0.3 : mono
Guessed Channel Layout for  Input Stream #0.4 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fcp_capture.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2012-11-28 08:06:53
  Duration: 00:00:00.07, start: 0.100434, bitrate: 173589 kb/s
    Stream #0:0(eng): Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x486, 66983 kb/s, 11.96 fps, 7.47 tbr, 2997 tbn, 2997 tbc
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
      timecode        : 00:59:14;24
    Stream #0:1(eng): Subtitle: eia_608 (c608 / 0x38303663)
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
    Stream #0:5(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
      timecode        : 00:59:14;24
[mov @ 0x7fe492087a00] Using MS style video codec tag, the file may be unplayable!
Output #0, mov, to 'throughffmpeg.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf54.38.100
    Stream #0:0(eng): Video: ffv1, yuv422p, 720x486, q=2-31, 200 kb/s, 30k tbn, 29.97 tbc
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
      timecode        : 00:59:14;24
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, 2304 kb/s
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, 1152 kb/s
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, 1152 kb/s
    Metadata:
      creation_time   : 2012-11-28 08:06:53
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> ffv1)
  Stream #0:2 -> #0:1 (copy)
  Stream #0:3 -> #0:2 (copy)
  Stream #0:4 -> #0:3 (copy)
Press [q] to stop, [?] for help
frame=    2 fps=0.0 q=0.0 Lsize=      69kB time=00:00:00.16 bitrate=3380.9kbits/s    
video:28kB audio:38kB subtitle:0 global headers:0kB muxing overhead 4.679602%

Note that if I omit the -vsync 0 then the timecode is still off but I get duplicated frames instead of a longer-duration frame at the beginning, thus my 2 frame source becomes a 5 frame output. Thus for a lossless transcode from mov to mov I'm using -vsync 0.

Dave Rice


More information about the ffmpeg-user mailing list