View Single Post
Old 13th June 2017, 16:28   #17  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by kriNon View Post
So I believe I have found a way to detect the bad frames.

Using this script:
Code:
SetMemoryMax(2048)
video1=MPEG2Source("I:\[NHK]\Welcome to the NHK [DVDISO-PAL]\Disk1\episode1.d2v")
video2=video1.QTGMC(InputType=2)
video3=subtract(video1,video2)
video4=subtract(BlankClip(video3),BlankClip(video3))
compare(video4, video3)
compare will give an output at the top of the screen, and from what I have seen, if Mean Abs Dev is greater than about 0.97 then it will be a bad frame.

Does anyone know how I could get the value of Mean Abs Dev from the compare function, and then if it is greater than 0.97 output the frame number, ideally into a text file?

I guess I'll probably need to use a combination of ConditionalFilter and WriteFile? How would I go about getting an output from compare though? Any ideas?

I don't think compare() (PSNR) has an equivalent internal runtime function . But you might be able to use something similar like lumadifference

This seems to work ok on your test clip with a threshold of 1.31 (use show=false to disable the debug overlay) . You might have to tweak the value for other sections

Code:
video1=MPEG2Source("VTS_02_1.demuxed.d2v", cpu=0)
video2=video1.QTGMC(InputType=2)
video3=subtract(video1,video2)
video4=subtract(BlankClip(video3),BlankClip(video3))

ConditionalFilter(video4, video2, video1, "LumaDifference(video4,video3)", ">", "1.31", show=true)
poisondeathray is offline   Reply With Quote