Opened 5 years ago

Closed 2 months ago

#1137 closed enhancement (fixed)

adher to start media time in QuickTime edts/elst

Reported by: dericed Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mov edts
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by cehoyos)

When a Quicktime file is opened in Quicktime 7 Pro, edited and saved (not "Save As" or "Export", but "Save") then a new moov chunk is written with the updated start times and durations in the edts chunk. Quicktime and VLC subsequently play the file back according to the edit list, but ffmpeg uses the entire timeline.

To replicate the issue, I made a 5 second Quicktime file using

ffmpeg -f lavfi -t 5 -i testsrc -c:v ffv1 -an 5seconds.mov

and then opened it in Quicktime 7 Pro and edited out one second from the beginning and end. I then hit "Save" and renamed the file to 5seconds_cut_with_QT.mov.

When I then tried to use 5seconds_cut_with_QT.mov as an input to ffmpeg the whole 5 seconds is decoded and used in the output, instead of the limited timeline specified in the edit list.

ffmpeg started on 2012-03-26 at 20:16:31
Report written to "ffmpeg-20120326-201631.log"
Command line:
ffmpeg -y -report -i 5seconds_cut_with_QT.mov -c:v ffv1 5seconds_cut_with_QT_resaved.mov
ffmpeg version N-35853-g8f0d9b4 Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar 26 2012 16:53:53 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass
  libavutil      51. 44.100 / 51. 44.100
  libavcodec     54. 12.100 / 54. 12.100
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 66.100 /  2. 66.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 10.100 /  0. 10.100
  libpostproc    52.  0.100 / 52.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb7fa84b400] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb7fa84b400] ISO: File Type Major Brand: qt  
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb7fa84b400] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '5seconds_cut_with_QT.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.3.100
  Duration: 00:00:03.00, start: -1.000000, bitrate: 1383 kb/s
    Stream #0:0(eng), 1, 1/25: Video: ffv1 (FFV1 / 0x31564646), bgr0, 320x240, 825 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      handler_name    : Apple Alias Data Handler
[buffer @ 0x7fb7fa4195a0] w:320 h:240 pixfmt:bgr0 tb:1/1000000 sar:0/1 sws_param:
[ffv1 @ 0x7fb7fa87da00] detected 8 logical cores
[ffv1 @ 0x7fb7fa853a00] detected 8 logical cores
[mov @ 0x7fb7fa87d400] Using MS style video codec tag, the file may be unplayable!
Output #0, mov, to '5seconds_cut_with_QT_resaved.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.3.100
    Stream #0:0(eng), 0, 1/25: Video: ffv1, bgr0, 320x240, q=2-31, 200 kb/s, 25 tbn, 25 tbc
    Metadata:
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (ffv1 -> ffv1)
Press [q] to stop, [?] for help
frame=   93 fps=0.0 q=0.0 size=     380kB time=00:00:03.72 bitrate= 837.2kbits/s    
frame=  125 fps=0.0 q=0.0 Lsize=     505kB time=00:00:05.00 bitrate= 827.1kbits/s    
video:504kB audio:0kB global headers:0kB muxing overhead 0.247244%

Attachments (5)

5seconds_cut_with_QT.mov (506.7 KB) - added by dericed 5 years ago.
quicktime file with edts. A 5 second quicktime with 1st and last second edited out in Quicktime 7 and then 'saved' (not save as).
5seconds_cut_with_QT_using_mpeg4_before_QT_save.mov (24.5 KB) - added by dericed 4 years ago.
quicktime file created wth ffmpeg -f lavfi -i testsrc=d=5 5seconds_cut_with_QT_using_mpeg4_before_QT_save.mov
5seconds_cut_with_QT_using_mpeg4_after_QT_save.mov (27.3 KB) - added by dericed 4 years ago.
copy of the 5seconds_cut_with_QT_using_mpeg4_before_QT_save.mov file, but edited and saved in Quicktime (not save as, so the edit info is appended)
5seconds_with_tc.mov (1.2 MB) - added by dericed 4 years ago.
5 second test video created by ffmpeg with timecode track
5seconds_with_tc_with_QTedit.mov (1.2 MB) - added by dericed 4 years ago.
copy of 5seconds_with_tc.mov with a QuickTime? based edit and save

Change History (9)

Changed 5 years ago by dericed

quicktime file with edts. A 5 second quicktime with 1st and last second edited out in Quicktime 7 and then 'saved' (not save as).

comment:1 Changed 5 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Description modified (diff)
  • Keywords mov added; quicktime removed
  • Priority changed from normal to wish
  • Reproduced by developer set
  • Status changed from new to open
  • Version changed from unspecified to git-master

(I wonder if using ffv1 for the sample instead of for example mpeg4 really is a good idea.)

Changed 4 years ago by dericed

quicktime file created wth ffmpeg -f lavfi -i testsrc=d=5 5seconds_cut_with_QT_using_mpeg4_before_QT_save.mov

Changed 4 years ago by dericed

copy of the 5seconds_cut_with_QT_using_mpeg4_before_QT_save.mov file, but edited and saved in Quicktime (not save as, so the edit info is appended)

comment:2 Changed 4 years ago by dericed

@cehoyos. I added mpeg4 versions of the sample files.
I created tbe before file with "ffmpeg -f lavfi -i testsrc=d=5 5seconds_cut_with_QT_using_mpeg4_before_QT_save.mov".
I then duplicated the file and named the copy "ffmpeg -f lavfi -i testsrc=d=5 5seconds_cut_with_QT_using_mpeg4_after_QT_save.mov". I then opened the file in QuickTime? Pro 7, edited some frames from the beginning and end and hit save.
When I now open "5seconds_cut_with_QT_using_mpeg4_after_QT_save.mov" in Quicktime it will start on frame number 1 and the 'before' file starts on 0. For ffmpeg both files present the same, starting from 0.

Changed 4 years ago by dericed

5 second test video created by ffmpeg with timecode track

Changed 4 years ago by dericed

copy of 5seconds_with_tc.mov with a QuickTime? based edit and save

comment:3 Changed 4 years ago by dericed

I added a new sample file created with:

ffmpeg -f lavfi -i mandelbrot -t 5 -pix_fmt yuv420p -timecode "01:00:00:00" 5seconds_with_tc.mov

Then resulting file is 5 seconds with a timecode track that goes from 01:00:00:00 to 01:00:04:24.
I then opened 5seconds_with_tc.mov in QuickTime? 7, edit the file, and then saved it by hitting File>Save rather than File>"Save As" (whereas as "Save As" would remux the file via QuickTime?, hitting only "Save" will relabel the existing 'moov' atom as 'free' and then append a new 'moov' atom to the file). The resulting file after the edit and save is named 5seconds_with_tc_with_QTedit.mov and in QuickTime? shows a timecode track that goes from 01:00:02:00 to 01:00:03:24.

When I analyze the two files with ffmpeg I get:

ffmpeg -i 5seconds_with_tc.mov -i 5seconds_with_tc_with_QTedit.mov 
ffmpeg version 1.0.git Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  1 2013 20:04:43 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (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. 13.100 / 52. 13.100
  libavcodec     54. 85.100 / 54. 85.100
  libavformat    54. 59.100 / 54. 59.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.102 /  3. 30.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '5seconds_with_tc.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.59.100
  Duration: 00:00:05.00, start: 0.000000, bitrate: 2012 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 2007 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
    Metadata:
      handler_name    : DataHandler
      timecode        : 01:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : DataHandler
      timecode        : 01:00:00:00
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '5seconds_with_tc_with_QTedit.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.59.100
  Duration: 00:00:02.00, start: -2.000000, bitrate: 5044 kb/s
    Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 2007 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
    Metadata:
      handler_name    : Apple Alias Data Handler
      timecode        : 01:00:00:00
    Stream #1:1(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : Apple Alias Data Handler
      timecode        : 01:00:00:00
At least one output file must be specified

Both files show a timecode value of "01:00:00:00". ffplay and ffmpeg decoding of 5seconds_with_tc_with_QTedit.mov will use all 5 seconds of the file although QuickTime? will only present the 2 seconds that were left after the editing.

comment:4 Changed 2 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.