Log in

View Full Version : Captured video error check


Caleb13
26th July 2005, 10:02
I'm using ASUS TV FM card with FLY 2000 TV software as VCR-in-PC. The captured video (768x576, 25 fps) is compressed in real time by DivX 5.2.1 codec (1-pass, "Fastest Encode Performance", quantizer 2) and written on HDD in AVI format. This of course generates rather high output files (one hour eats up about 8 GB), so if I like something and want to keep it, I recompress it into XviD. I use AviSynth to crop, denoise etc. the video in the process.

Because I capture from analog terrestrial TV stations, quality of the signal is not always the best. Once in a time (highly depending on atmospheric conditions), the TV card loses synchronisation and the captured video contains dropped or damaged frames. Problem is that these errors are usually very difficult to notice when I watch the captured video directly in BSPlayer (DivX decoder apparently tries to mask the errors somehow). The errors are, however, VERY well visible after AviSynth processing. I don't know why, but AviSynth sometimes replaces missing or corrupt frames with random previous ones - which looks very disconcertingly. So I looked for a way how to detect corrupt frames in the captured video in order to eliminate them using, say, FreezeFrame AVS filter. I tried DivFix, which works perfectly, but can read first 2 GB of AVI files only. Of course, I could break the captured video into 2 GB chunks and check them separately, but that proved to be a bit cumbersome (not to mention that it also requires excessive HDD activity). The error checking in VirtualDubMod is useless, as it reports only absolutely unreadable frames, not "merely" corrupt ones (and the checking is *very* slow).

So my questions is: Is there any way/program which could check for corrupt frames in DivX video files bigger than 2 GB?

Thanks for any ideas.

jggimi
26th July 2005, 15:54
Your problem could be codec related, it could be capture related, it could be AviSynth related. There's no way to know from the information provided so far.

Are you willing and technically able to extract a sample section from the source .avi where the frames are "corrupt" ?? If so, would you post the sample (or a link to it)? In addition, would you also post a copy of the AviSynth script you use for your DivX -> XviD post processing?

Caleb13
27th July 2005, 21:58
Well, I certainly can post a sample with one of those errors. I don't think, however, that it will be of much help. The errors are present only in videos which were captured "from the air." When I capture S-Video signal from VCR or other quality analogue source, I don't have these problems. The errors are not THAT frequent anyway - usually, it is one error in a hour or more, but it can also be one every 20 minutes when the weather is bad. That's why I asked about the error checking in the first place, you know. :)

But it is also possible that the problem is DivX-related. The resolution of the captured video is high and the TV source is usually rather noisy. There is a possibility that the codec's buffer overflows or something like that. (Or at least, I had this type of problem with Alparysoft Lossless Codec, which simply couldn't handle this high resolution and complexity of the source video.) Well, I guess it will be best if I post the sample after all. :)

Here it is (I was unable to upload it here; ZIP files size limit is apparently 300 KB here):

www.webpark.cz/caleb13/corruptsample.zip

There are two videos in the ZIP file. The first is contains 20 frames of the captured video with the corrupt/missing 10th frame (sorry, I couldn't make it smaller because of keyframes). I cut it out from the captured stream using VDM - Frame selection - Direct stream copy. If you seek the video in VDM, you will surely notice the missing/corrupt frame. But if you play it, the missing frame is hard to notice. Yes, you will notice it, because you will know it is there. But try catching something like that in hours of video, especially when you actually plan to enjoy what you are watching.

The second file contains the same scene, but after AVS processing. 1-pass XviD, quantizer 10 was used for the compression of the sample (to make it small). As you can see, there is a frame which simply doesn't belong there. It came from a scene which is placed about 3 seconds prior the corrupt frame. The interesting thing is that the "inapropriate" frame is different (taken from a different place) with every load of the AVS file into VDM.

Here is the AVS script I use:

LoadPlugin("C:\PROGRA~1\GORDIA~1\undot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\FluxSmooth.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\audgraph.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\KernelDeInt.dll")
avisource("[path]\[filename].avi")
duplicateframe(100)
duplicateframe(101)
duplicateframe(102)
duplicateframe(103)
duplicateframe(103)
duplicateframe(103)
Killaudio
trim(7274,42860)
#KernelDeInt(order=1,sharp=true)
#Greyscale()
crop(6,0,760,570)
Undot()
#FluxSmooth(5,7)
#FluxSmooth(7,7)
FluxSmooth(25,30)
Undot()
FluxSmooth(25,30)
BicubicResize(640,480,0,0.5)
#converttorgb32()
#audiograph(5)

I use DuplicateFrame to correct audio/video delay (I check that with the AudioGraph filter). The unusually hard cascaded denoising is used because the movie (an old TV show) was shot on low quality film material and the picture is therefore very grainy.

The contents of the AVS file doesn't matter, however! I tried to put only single line - avisource("[path]\[filename].avi") in an AVS file and open it in VDM - and the problem is the same!

I also tried to load "Corrupted captured video.avi" through AVS script. The corrupt frame was replaced by a green frame in this case.

Well, as I said, I don't think much can be done. I don't believe the errors are codec-related, because they happen in low-motion and/or low-complexity scenes as well (which is also the case of the sample I provided). The sources of the errors (bad weather, interference from cell phones or passing-by cars) can't be eliminated. If I could at least reliably detect them, it would be good enough for me.

But if you find some other solution, I will be thankful!