mifi / lossless-cut

The swiss army knife of lossless video/audio editing
https://losslesscut.app/
GNU General Public License v2.0
25.88k stars 1.25k forks source link

Merge/concat. 2 videos results in corrupted video file besides input having identical resolution, audio and video codec #1215

Closed HalloUeb closed 2 years ago

HalloUeb commented 2 years ago

I downloaded video files from YouTube using ClipGrab. When using the "Merge/concatenate" on them some specific files this result in corrupted merged files besides the input files having identical resolution, audio and video codec (according to the codec info from VLC video player)

I get the same error with LosslessCut version 3.45.0 and 3.42.0 (I only tried these 2 versions) I use the appImage version of LosslessCut on Linux Mint.

Steps to reproduce (on version 3.45.0) 1) Drag and drop the 2 provided video files into LosslessCut 2) Press button "Merge/Concatenate files" 3) On "Merge/Concatenate files" dialog click "Merge!" (without doing anything else or changing any option) 4) Open the merged file with a video player (I tried VLC and Celluloid)

Observe that the first few seconds of the merged video corresponding first input file is replayed correctly while the part corresponding to the second input file is not replayed at all

Here are the 2 video files (zipped) to reproduce the error: https://www.dropbox.com/s/y8tbaahow6x5dnv/2vidoes.zip?dl=0

I will happily provide any additional information if needed.

mifi commented 2 years ago

thanks for providing sample files. I was able to reproduce the problem.

the files are in fact not identical in codec params and that's what's causing the problem:

99 Degrees Aztec Pop Cheeky Bikini Bottom.mp4

  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 608x1080 [SAR 1:1 DAR 76:135], 763 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Adidas Womens Kaleidoscope Open Scoop Two Piece Swimsuit.mp4

  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 608x1080 [SAR 1:1 DAR 76:135], 767 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)

Notice how the former has 90k tbn and the latter has 30k tbn. Apparently ffmpeg doesn't automatically convert these, so that's causing the problem.

when converting the second file (losslessly) to 90k tbn first, and then concating the resulting file (and the original first file) with losslesscut, it works:

ffmpeg -i Adidas\ Womens\ Kaleidoscope\ Open\ Scoop\ Two\ Piece\ Swimsuit.mp4 -video_track_timescale 90000 -c copy Adidas\ Womens\ Kaleidoscope\ Open\ Scoop\ Two\ Piece\ Swimsuit-90k.mp4

This issue has been reported before in #455 so I'm going to close this issue as a duplicate, and will continue discussion there. I will probably implement this conversion automatically built into losslesscut if timebase differs in two or omore files