Opened 3 years ago

Last modified 11 months ago

#9304 open defect

Support strange / multiple editlists without -ignore_editlist 1

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

Description

Summary of the bug: A working video file becomes invalid after a simple copy

How to reproduce:

% ffmpeg -i broken-example.mp4 -c:v copy out.mp4
ffmpeg version N-102791-gaca923b365
built with Apple clang version 12.0.0 (clang-1200.0.32.29)

You can obtain broken-example.mp4 (3.5MB) here: https://www.dropbox.com/s/tky9p7jmoe8tx4z/broken-example.mp4?dl=1

This began as much more complex failed encoding operation, but this test case is so trivial I believe it will be easier to debug. This input is successfully playable using Quicktime on OSX (although it can't be played with some other players).

What you observe is it begins with a normal video clip, followed by what seems like a slideshow frame. My guess is it is using a variable frame rate to deliver the final slideshow image, but I am unsure how to determine this using ffprobe.

After the encoding the file returned by ffmpeg appears corrupt where the 'slideshow' frame began, approx 9 seconds into the original clip.

For anyone who does not have a Mac with Quicktime, I have prepared a screen recording of the successful playback of the original video here: https://www.dropbox.com/s/qs5ssk8832s5dek/example-playback.mp4?dl=1

I have no doubt the input video file is broken in some way, but I would still like for ffmpeg to be able to operate with it if possible. Thank you for all the work you do to create this incredibly powerful tool.

Change History (6)

comment:1 by Carl Eugen Hoyos, 3 years ago

Component: ffmpegundetermined
Keywords: mov added
Priority: normalwish
Summary: Video Becomes Unplayable After -c:v copySupport strange / multiple editlists without -ignore_editlist 1
Type: defectenhancement

For future tickets: Please always provide the command line you tested together with the complete, uncut console output.

$ ffmpeg -i broken-example.mp4 
ffmpeg version N-102796-g81bad080cd Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  2.100 / 59.  2.100
  libavformat    59.  3.101 / 59.  3.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.103 /  8.  0.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3a8f580] st: 0 edit list: 2 Missing key frame while searching for timestamp: -1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3a8f580] st: 0 edit list 2 Cannot find an index entry before timestamp: -1.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'broken-example.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp41mp42
    creation_time   : 2020-02-17T19:51:14.000000Z
  Duration: 00:00:13.38, start: 0.000000, bitrate: 2067 kb/s
  Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280, 1880 kb/s, SAR 1:1 DAR 9:16, 17.71 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      creation_time   : 2020-02-17T19:51:14.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2020-02-17T19:51:14.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
At least one output file must be specified

Behaviour changed several times for this sample, I didn't immediately find a version that works better than current FFmpeg.

comment:2 by Zack Bloom, 3 years ago

For future tickets: Please always provide the command line you tested together with the complete, uncut console output.

Understood, thank you for the feedback.

Should I understand that this issue should be resolved by adding -ignore_editlist 1? Unfortunately it's not, this command changes the output but it still stutter and freezes at the offending moment:

%  ffmpeg -i broken-example.mp4 -ignore_editlist 1 -c:v copy out.mp4
ffmpeg version N-102791-gaca923b365 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-aca923b_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  2.100 / 59.  2.100
  libavformat    59.  3.101 / 59.  3.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.102 /  8.  0.102
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb1d9e08280] st: 0 edit list: 2 Missing key frame while searching for timestamp: -1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb1d9e08280] st: 0 edit list 2 Cannot find an index entry before timestamp: -1.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'broken-example.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp41mp42
    creation_time   : 2020-02-17T19:51:14.000000Z
  Duration: 00:00:13.38, start: 0.000000, bitrate: 2067 kb/s
  Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280, 1880 kb/s, SAR 1:1 DAR 9:16, 17.71 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      creation_time   : 2020-02-17T19:51:14.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2020-02-17T19:51:14.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp41mp42
    encoder         : Lavf59.3.101
  Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280 [SAR 1:1 DAR 9:16], q=2-31, 1880 kb/s, 17.71 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      creation_time   : 2020-02-17T19:51:14.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
    Metadata:
      creation_time   : 2020-02-17T19:51:14.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.2.100 aac
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189450, current: 126986; changing to 189451. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189451, current: 126986; changing to 189452. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189452, current: 126986; changing to 189453. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189453, current: 126986; changing to 189454. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189454, current: 126986; changing to 189455. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189455, current: 126986; changing to 189456. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189456, current: 126986; changing to 189457. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189457, current: 126986; changing to 189458. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189458, current: 126986; changing to 189459. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189459, current: 126986; changing to 189460. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189460, current: 126986; changing to 189461. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189461, current: 126986; changing to 189462. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189462, current: 126986; changing to 189463. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189463, current: 126986; changing to 189464. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189464, current: 126986; changing to 189465. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189465, current: 126986; changing to 189466. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189466, current: 126986; changing to 189467. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189467, current: 126986; changing to 189468. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189468, current: 126986; changing to 189469. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189469, current: 126986; changing to 189470. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189470, current: 126986; changing to 189471. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189471, current: 126986; changing to 189472. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189472, current: 126986; changing to 189473. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189473, current: 126986; changing to 189474. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189474, current: 126986; changing to 189475. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189475, current: 126986; changing to 189476. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189476, current: 126986; changing to 189477. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189477, current: 126986; changing to 189478. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189478, current: 126986; changing to 189479. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189479, current: 126986; changing to 189480. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189480, current: 126986; changing to 189481. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189481, current: 126986; changing to 189482. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189482, current: 126986; changing to 189483. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189483, current: 126986; changing to 189484. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189484, current: 126986; changing to 189485. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189485, current: 126986; changing to 189486. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189486, current: 126986; changing to 189487. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189487, current: 126986; changing to 189488. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189488, current: 126986; changing to 189489. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189489, current: 126986; changing to 189490. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189490, current: 126986; changing to 189491. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189491, current: 126986; changing to 189492. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189492, current: 126986; changing to 189493. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189493, current: 126986; changing to 189494. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189494, current: 126986; changing to 189495. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189495, current: 126986; changing to 189496. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189496, current: 126986; changing to 189497. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189497, current: 126986; changing to 189498. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189498, current: 126986; changing to 189499. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189499, current: 126986; changing to 189500. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189500, current: 126986; changing to 189501. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189501, current: 126986; changing to 189502. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189502, current: 126986; changing to 189503. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189503, current: 126986; changing to 189504. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189504, current: 126986; changing to 189505. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189505, current: 126986; changing to 189506. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189506, current: 126986; changing to 189507. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189507, current: 126986; changing to 189508. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189508, current: 126986; changing to 189509. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189509, current: 126986; changing to 189510. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189510, current: 126986; changing to 189511. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189511, current: 127708; changing to 189512. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189512, current: 143068; changing to 189513. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189513, current: 158428; changing to 189514. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189514, current: 173788; changing to 189515. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fb1d9f234c0] Non-monotonous DTS in output stream 0:0; previous: 189515, current: 189148; changing to 189516. This may result in incorrect timestamps in the output file.
frame=  321 fps=0.0 q=-1.0 Lsize=    4244kB time=00:00:12.33 bitrate=2817.7kbits/s speed= 105x
video:4162kB audio:71kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.245510%
[aac @ 0x7fb1d9f258c0] Qavg: 1108.590

This might be a separate issue, but I have also observed that the concat filter terminates the output at this file, even if there are more files to be concatenated, even with ignore_editlist active.

Last edited 3 years ago by Zack Bloom (previous) (diff)

comment:3 by Zack Bloom, 3 years ago

Priority: wishnormal
Type: enhancementdefect

Moving this back to defect just until someone can confirm the new title is actually applicable, given that ignore_editlist 1 does not fix the issue.

comment:4 by Carl Eugen Hoyos, 3 years ago

Component: undeterminedavformat
Reproduced by developer: set
Status: newopen

To the best of my knowledge, the file has never worked better with older versions of FFmpeg. What you originally requested will likely never work, copying edit lists is not supported.
I believe the file should also work without ignoring the edit list, originally the console output was a little more helpful to find the work-around.

comment:5 by Balling, 3 years ago

The mp4v2 file breaks the 264 decoder (only without -ignore_editlist 1 that is). File looks like has two different CFR videos, so the file is not strictly VFR.

ffmpeg -ignore_editlist 1 -i broken-example.mp4 -vf vfrdet -an -f null -

[Parsed_vfrdet_0 @ 000002b5aa346640] VFR:0.000000 (0/249)
frame=  255 fps=0.0 q=-0.0 Lsize=N/A time=00:00:13.33 bitrate=N/A speed=37.2x
video:110kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_vfrdet_0 @ 000002b5aa88ef00] VFR:0.000000 (0/4)
Last edited 3 years ago by Balling (previous) (diff)

comment:6 by Balling, 11 months ago

Parsed slightly different now:

[Parsed_vfrdet_0 @ 0000017906dfef00] VFR:0.000000 (0/249)
[out#0/null @ 000001790664cbc0] video:120kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
frame= 255 fps=0.0 q=-0.0 Lsize=N/A time=00:00:13.40 bitrate=N/A speed=39.2x
[Parsed_vfrdet_0 @ 0000017906dfef00] VFR:0.000000 (0/4)

Note: See TracTickets for help on using tickets.