In another forum someone asked if it was possible to check for dropped frames in an MPEG-2 file captured with ATI MMC. When capturing directly to MPEG-2, ATI MMC automatically repeats the previous frame when a frame is dropped, so it should be possible to find dropped frames by scanning the MPEG-2 file and comparing each frame with the previous one. Even when the picture is static, two consecutive frames are never identical because of the noise, so if both frames are completely identical it would mean a frame was dropped. I'm wondering if finding and counting dropped frames in an MPEG-2 file that way is possible with an Avisynth script.
It works. I'm impressed. But I'm an Avisynth newbie (I've only used it for noise reduction) so I'd like to know how I can count the dropped frames and then create a text file with the number of dropped frames and the actual frame numbers. A text file containing something like this: Dropped frames: 3 (48,114,310)
It might be possible if you can have a variable be incremented everytime the conditional hits true, and then check when the framenumber is the last (currentframenumber == framecount) and throw an error with the amount of duplicate frames found. But I am far too AVISynth noob to know if this is possible or not without extensively reading the manual and cursing at AVISynth for plaguing me with errors that I will have caused 90% of the time :D.
OK - I'm guessing here - I cannot test anything. (If it works at all) - load it into vdub. Let it run from start to end, and you should have the total number of drops. Code:
--------------------- 31% produkcji Telewizji Polskiej finansowane jest z abonamentu [br]
Yes, it works, but I noticed now that it reports one dropped frame too many. If I open the script in VirtualDubMod it always counts 1 dropped frame as soon as I hit the right arrow, although there is no dropped frame at the beginning of the file. All the other dropped frames are counted correctly. (This also happened with the first draft of the script.) Very interesting so far though. Edit: After adding "after_frame=true" it now counts the extra dropped frame when I hit the right arrow twice.
--------------------- Moje źródło o serwisach VOD i e-video w Polsce i na Świecie >>>
I removed "after_frame=true" again. With "after_frame=true" it augments the counter one frame late. For example. If frame #107 is an exact copy of frame #106 the counter is augmented when I reach frame #108. Without "after_frame=true" the counter is augmented when I reach frame #107.
oh right - frame 0 will always count as a duplicate, as it will compare itself to frame -1, which is then corrected to frame 0 (itself). Just initialize it to "-1", and you'll get the correct count. The "after_frame" funtionality is to be expected, as it will make the framescript evaluate after the frame with the counter has been drawn. I know other people here will be able to help you print out frame numbers to a file.
For outputting frames to a textfile, try using , use the Write() function (you'll need to download the chr_25_dll_20030920 version). The example given in the readme (slightly modified): Code: