QLVideo icon indicating copy to clipboard operation
QLVideo copied to clipboard

Some .mkv files show as corrupted

Open frozenpandaman opened this issue 4 years ago • 14 comments

e.g. image

image

frozenpandaman avatar Nov 13 '21 04:11 frozenpandaman

Hi, have you tried to re-index them like HandBrake does?

eirnym avatar Nov 13 '21 10:11 eirnym

@eirnym What do you mean?

frozenpandaman avatar Nov 13 '21 10:11 frozenpandaman

Handbrake has a feature to rebuild time-to-frame indices in a video file. Sometimes indices became corrupted and video could be still playable, but automated tools can give strange output. "Force re-index" process usually fixes these issues, full re-encoding is not required, but also helpful.

Basically, this plugin does sampling video file at specific moments using ffmpeg library. You can try to fetch some screenshots by yourself based using ffmpeg using something like following command ffmpeg -ss 01:23:45 -i input -vframes 1 -q:v 2 output.jpg.

eirnym avatar Nov 13 '21 13:11 eirnym

Thanks! It's likely just a problem with the video file itself, then. I think some users would want to preserve the files exactly from the source they're downloaded, so modifying the video (i.e. the md5 hash or bytes changing in any way) or re-encoding isn't always an option. Can you point me to the Handbrake command that does this? I can't find the option in the GUI either, but would be interested to try it out per your suggestion.

You're right – the ffmpeg command you provided outputs a similarly (though not identically) messed up screenshot. Wonder if there's any way to fix this, since it does display properly during playback, when scrubbing to it, etc.?

frozenpandaman avatar Nov 14 '21 07:11 frozenpandaman

Also (maybe this is different enough to deserve its own issue?) I've noticed some files, particular those with large file sizes, show up as having completely black thumbnails: However, clicking on one of the sidebar thumbnails displays the full image, but the sidebar remains black: Sometimes when viewing the file in Quick Look, a few of the images show, but not all, and it's often different ones each time:

frozenpandaman avatar Nov 14 '21 07:11 frozenpandaman

Reindexing usually solves the problem. Basically in most cases there's 2 kind of frames: full image frame with full image and motion frame. Index shows where full frames are for fast forward feature.

eirnym avatar Nov 14 '21 11:11 eirnym

Not all sources have good files in them. Broken video files and won't be shown correctly except you're lucky enough as you described.

eirnym avatar Nov 14 '21 11:11 eirnym

Reindexing usually solves the problem.

Could you point me how to do this? I didn't see the option looking through the Handbrake CLI tools or GUI.

frozenpandaman avatar Nov 14 '21 11:11 frozenpandaman

really, thanks for noticing me :) it uses ffmpeg underneath, so I found answer fairly quickly

Tell ffmpeg to put into a new container (even with the same format and video/audio streams will be copied as they are)ffmpeg -i infile -c:v copy -c:a copy outfile or recode as you pleased.

eirnym avatar Nov 14 '21 11:11 eirnym

My guess is it's possible to make the same with Handbrake GUI, probably by adding this action as a new preset (without recoding video and audio)

eirnym avatar Nov 14 '21 11:11 eirnym

Ah, you just meant "fix" it like that, got it. I'm happy (and more comfortable) with using ffmpeg anyway – you just mentioned Handbrake before, so I was going off that.

However, running that command doesn't fix either of the issues (black thumbnails and corrupted thumbnails). For the former, at least, it's not an issue with the video file – it's an issue with QLVideo, likely due to the file size.

frozenpandaman avatar Nov 14 '21 13:11 frozenpandaman

I used Handbrake for this back in the day.

Returning to your question, does ffmpeg returns correct images?

eirnym avatar Nov 14 '21 20:11 eirnym

does ffmpeg returns correct images?

"the ffmpeg command you provided outputs a similarly (though not identically) messed up screenshot" https://github.com/Marginal/QLVideo/issues/93#issuecomment-968240959

frozenpandaman avatar Nov 19 '21 11:11 frozenpandaman

Probably you should file an issue to ffmpeg itself then. I'd love to know any way how to fix these video files as well

eirnym avatar Nov 19 '21 22:11 eirnym

If FFmpeg doesn't like the file then unfortunately QLVideo won't either. Closing.

Marginal avatar Dec 07 '22 23:12 Marginal