R&D
From SDA Knowledge Base
Auto Decimate
Original topic: http://speeddemosarchive.com/forum/index.php/topic,10578.0.html
So I revisited an AviSynth filter called Dup by Neuron2. It analyzes the video, looks for duplicate frames and has the ability to create a log file which can be parsed to determine if a video is likely F1, 2, or 3. The filter is not 100% accurate - such was my expectation the last time I visited this and subsequently became discouraged and gave up - but I don't think it needs to be.
- Download Dup (2.30) and extract to AviSynth plugins directory
- Created two text files: dupcount.bat and RunNullVideoPass.vcf. Modify path to vdub.exe cli as needed.
RunNullVideoPass.vcf
VirtualDub.Open(VirtualDub.params[0]); VirtualDub.RunNullVideoPass();
dupcount.bat
@echo off SETLOCAL ENABLEDELAYEDEXPANSION SET vdubdir=C:\Program Files\VirtualDub-1.9.5 SET duplog=%~dp1dup.txt SET unique=0 SET duplicate=0 "%vdubdir%\vdub.exe" /i RunNullVideoPass.vcf %1 FOR /F "skip=2 tokens=3,6 delims=: " %%G IN ('type "%duplog%"') DO ( IF "%%G"=="%%H" ( IF !dupseq! LEQ 2 ( SET /A unique= !unique! + 1 SET /A duplicate= !duplicate! + !dupseq! ) SET dupseq=0 ) ELSE ( SET /A dupseq=!dupseq! + 1 ) ) SET /A total = %unique% + %duplicate% SET /A uniquepercent = (%unique% * 100) / %total% ECHO. ECHO Frames counted: %total% ECHO Unique: %unique% ECHO Percentage: %uniquepercent% ECHO. PAUSE
- Add following AviSynth code after separatefields
Dup(threshold=20, blksize=16, debug=true, log="dup.txt")
- Open a command prompt: dupcount.bat avisynthscript.avs
- Result of F1 video, short sample:
http://img5.imageshack.us/img5/866/dup.png
Obviously not 100%, but if it's above 50%.... Can play with the thresholds after doing more testing... (nate? :) )
Any thoughts?
Extra links: [1]
edit- Menus will affect results from the dup filter... The above screenshot was a sample of sonic 2 which had a little bit of intro. Take out the intro and the percentage rises to 97 percent. May be possible to add a bit more logic to the batch file, detecting when there's a string of duplicates higher than say.. 3-5 and ignoring them.
edit- Updated batch code with above idea, getting surprisingly accurate results: 95/49/33% on F1/F2/F3. Basically the code ignores sequences of DDDU or DDDDDDDDDU, etc. It will count only sequences of UU, DU, DDU.
http://img188.imageshack.us/img188/5900/50520378.png
http://img188.imageshack.us/img188/4189/40394732.png
http://img181.imageshack.us/img181/2788/60997384.png