Open nhershy opened 1 year ago
I appreciate the GUI, CorruptVideoInspector. I record OTA with HDHomeRun and was optimistic this would solve an issue where I could tell if a .mpg had pixelization (and the need to re-record it) prior to having to watch it. Only, as I have used it today to scan five mpg files, everyone comes back with a "1" indicating corrupted. I know two of the movies I had watched and noticed no issues with pixelization. Is this not going to work with the type of problem I am looking to resolve?
I use CCextractor to sort of scan my videos. When I see a lot of errors translating to a .srt file, I can often catch video issues. But sometimes this does not work when there is no dialog taking place in the movie, but a scene has pixelization anyway.
Thanks for reaching out!
As you know, this program uses the “ffmpeg” command under the hood to scan for corruption, bad frames, etc. So whatever the ffmpeg reports back, this program marks as corrupt. If ffmpeg does not report anything back, the file is deemed healthy.
So, if you were to run the same command https://superuser.com/questions/100288/how-can-i-check-the-integrity-of-a-video-file-avi-mpeg-mp4 in CMD or Terminal (depending on your OS), you will see that ffmpeg is reporting some corrupt frames on your video files.
I suppose this is a caveat of using this program: where the human eye does not detect any pixelation or glitches, there are still corrupt frames found in the file regardless, so it is marked “corrupt”. Maybe a future update to the program could allow the user to specify “percent of corruption” or something like that. And if only 1% or less of the file has bad frames, then it could still be marked healthy. But this is a slippery slope, because even in that 1% could contain pixelation to the human eye when watching the video.
Hope this helps explain the behavior a bit more. I’m sorry I don’t currently have a fast solution,
Thank you for your quick response this morning! I reckon based on my experience today then, most of my files probably have some corruption though not visible to me. Maybe the inert process of capturing OTA signals and writing them to a hard drive. A little beyond me to know what causes them to be corrupt.
I wonder in passing what type of video files are written that come out without being flagged?
I appreciate again your timely response!
Tom
This is an interesting problem. I wonder if there is a way to configure ffmpeg to decode in a faster way which would also potentially solve the issue of detecting unnoticeable errors, maybe only decode motion vectors, only color data, or only 1/x frames ?
https://github.com/bml1g12/benchmarking_video_reading_python
This is an interesting problem. I wonder if there is a way to configure ffmpeg to decode in a faster way which would also potentially solve the issue of detecting unnoticeable errors, maybe only decode motion vectors, only color data, or only 1/x frames ?
https://github.com/bml1g12/benchmarking_video_reading_python
You could use a hardware decoder. AMD, Intel and Nvidea all have one. using dxva2 should work on all GPU's if you're unsure what to use. (Windows, I don't know about Mac)
I did some tests more recently and wrote about it here: https://github.com/qarmin/czkawka/discussions/721#discussioncomment-7944891
Also, bitstream filters are very performant low-level operations:
ffmpeg -i in.mkv -c copy -bsf:v 'noise=drop=not(key)' out.mkv
I wonder if these could be use to reliably calculate corruption... maybe not this one specifically because different codecs have different keyframes
Two potential issues I've noticed with my testing of the program this evening:
1.) It seemed to be detecting supposed corruption in mp4 files that I am almost certain were not corrupt (my only explanation being that maybe there was something non-standard or non-compliant in the encoding of these mp4 files that it is treating as corruption -- these are mp4s that were recorded using an AVerMedia EzRecorder device, so I may do further testing of this with new recordings, and run them directly though ffmpeg to see the read out).
2.) It seemed to not notice corruption when I used it to scan two copies of what should be identical video files, with the problem being that one of the copies was found with WinMerge to have some kind of binary difference present (probable file corruption). Using CVFI to scan each of these files came back saying that neither were corrupt. My best explanation for this is that whatever binary differences were present, the differences just happened to not involve out-of-spec bits of the video/audio stream -- or maybe the corruption was in other bits of the file that ffmpeg can't distinguish as corrupt, like certain information in the file headers or what have you.
Two potential issues I've noticed with my testing of CVFI
If it's not too much trouble, it would be helpful to have more real-world feedback on a similar tool that I wrote:
pip install xklb
library media-check --full-scan video.mp4
binary difference present
If it's just one or two bits here and there it might not be possible for ffmpeg to detect it
@chapmanjacobd , thanks for mentioning your tool. Presumably, it can be run on Windows Subsystem for Linux? I could test it on the EzRecorder-produced mp4s, at least, to see what yours outputs. Unfortunately, I went ahead with getting rid of the files with the slight binary differences, but the EzRecorder-produced mp4s might still be interesting to analyze.
Yes it should be able to run under WSL but I've also used it in powershell and it seems to work fine as long as ffmpeg is in the Windows path
https://github.com/chapmanjacobd/library/blob/main/.github/Windows.md
You might need to do
python3 -m ensurepip
python3 -m pip install xklb
if you don't have pip or pip3 in your path
@chapmanjacobd Hey Jacob That seems to be quite an extensive tool and a great tool for what I want to do soon. I'd love to try it out. Would it be possible to contact you in a more direct way with problems, like on discord or such as I am quite new to this, so might need a bit of help setting it up properly.
I'd rather keep things public so that if others have similar trouble they can learn how to fix it. Please open a ticket on my repo if you have a specific problem or question
@chapmanjacobd Ok, no problem. I totally get that. I will let you know if I encounter any or have any suggestions or wishes for enhancements.
Not all videos are equally corrupt. If a video is found corrupt, figure out a way to see if it is 60% corrupt, or 0.2% corrupt, for example. Some videos are so corrupt that the video won't play. Others will play, but the corrupt frames happen so often that the movie is not enjoyable. But some scenarios a video is corrupt, but it is unnoticeable to the viewer. Or it may have one corrupt frame lasting half a second, which wouldn't be worth redownloading or repairing the video file.