lossless-cut icon indicating copy to clipboard operation
lossless-cut copied to clipboard

Playback errors in merged file (Invalid video timestamp)

Open cunlem opened this issue 2 years ago • 4 comments

Sometimes when cutting and merging youtube H.264 video I get a file with glitches at merge points that result in playback/seek errors in the player output (here mpv)

V: 00:00:25 / 00:00:28 (89%) Invalid video timestamp: 25.730367 -> 25.730367

This is not a bug in losslesscut but rather ffmpeg. Just writing to ask if others have experienced something similar and know why it happens

cunlem avatar Jun 21 '22 12:06 cunlem

which different export settings did you try? does it give the same result regardless?

mifi avatar Jun 26 '22 23:06 mifi

The defaults basically. I always use keyframe cut (the other option gives weird results). I tried fiddling with avoid negative timestamp value too.

The problem seems to be related to some of H.264 encoded videos from Youtube, especially when setting cut ends not on last frame before keyframe but somewhere in the middle of GOP. The file cuts play without errors after split. But after merge glitches at join points appear. Often typical errors in console during playback look like:

[null @ 0x56409c9d9c80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 113 >= 113
[h264 @ 0x56409ca41980] illegal short term buffer state detected
[h264 @ 0x56409ca56040] mmco: unref short failure

I haven't experienced such problems with VP9 Youtube videos. They are easier to cut in general. But H.264 is usually the highest quality version due to bigger size.

cunlem avatar Aug 22 '22 19:08 cunlem

Oh, that's interesting. I guess all we could do is to gather a minimal reproducible example command line with ffmpeg and report to ffmpeg.

mifi avatar Aug 23 '22 07:08 mifi

I analyzed it bit further and filed a bug with ffmpeg. Hopefully it's a matter of getting timestamp math right and they will be able to fix it.

cunlem avatar Aug 27 '22 13:08 cunlem