Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th May 2006, 01:50   #1  |  Link
Fudoh
Registered User
 
Join Date: Sep 2003
Posts: 15
Search for dropouts - how to mark or output ?

Hi fellows,

I've started digitizing old VHS tapes recently. As some of them are in very bad condition, there are bad fields (completely green) in the captured videos from time time.

Since I don't have the time to watch the captures in realtime, I've done this script to find the bad fields

clip = AviSource("d:\temp\source.avi").ConvertToYV12
white = AviSource("d:\temp\dropouts\white.avi").ConvertToYV12
black = AviSource("d:\temp\dropouts\black.avi").ConvertToYV12

ConditionalFilter(clip, white, black, "UDifferenceFromPrevious()", ">", "25", true)

white.avi is 2 hours solid white, black.avi is solid black.

The output is completely black with a white frame every time a bad (green) field appears in the source video. With the video output I can use the "find next transition" button in Virtual Dub to find the exact locations of the bad fields easily.

Problem is that it's only approx. 1/2 realtime and I have to note down the frame position and push the scan button again after every bad field. (BUT I can do while doing more important things on the PC anyway...)

So - I wonder - can the ImageWriter or ScriptClip function be combined with this one in any way ?? It would be great if the bad frames from the source.avi could be saved via ImageWriter in some way. Since only a field is bad when a dropout occurs I could still identify the position with a framegrab from this position...

I've seen that ScriptClip can even output the frame's' number, but I cannot figure out how to combine it with the conditionalfilter....

Any ideas or hints would be highly appreciated !!

Thanks,
Fudoh

Last edited by Fudoh; 29th May 2006 at 01:58.
Fudoh is offline   Reply With Quote
Old 29th May 2006, 04:20   #2  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
i have a dropped-frame interpolator that could be modded easily to replace any fully green field with a frame "morphed" from the adjacent frames. i'll dig it up and post it, but you'll have to do the modding - i'm at lunch

[edit]

Code:
function filldrops (clip c, int "idx")
{
idx=default(idx,1)

vf=c.mvanalyse(truemotion=true,pel=2,isb=false,delta=1,idx=idx)
vb=c.mvanalyse(truemotion=true,pel=2,isb=true,delta=1,idx=idx)
global filldrops_d = c.mvflowinter(vb,vf,time=50,idx=idx)
global filldrops_c = c
c.scriptclip("""ydifferencefromprevious()==0? filldrops_d : filldrops_c""")

}
now this works on full frames only, but i imagine it can be modified without too much of a speed hit (as it is, it runs well above realtime and can maintain realtime playback on my machine, even when there's tons of drops).

you'll need a newer version of the MVtools.
__________________
sucking the life out of your videos since 2004

Last edited by Mug Funky; 29th May 2006 at 04:23.
Mug Funky is offline   Reply With Quote
Old 29th May 2006, 21:21   #3  |  Link
hanfrunz
Registered User
 
hanfrunz's Avatar
 
Join Date: Feb 2002
Location: Germany
Posts: 536
what's the size of the black/white clips? Try to resize it to 8x8 pixels for speed increase. You could also use blankclip() to produce a black/white clip...
hanfrunz is offline   Reply With Quote
Old 30th May 2006, 13:58   #4  |  Link
Fudoh
Registered User
 
Join Date: Sep 2003
Posts: 15
@Mug Funky

Thanks ! This is unfortunately way above my understanding of the avisynth script language. Problem with it might be that I need to exame the dropouts by myself since some are longer than a single frame...

@hanfrunz

Thanks for the hint ! The script is now running slightly above realtime.

Nobody any idea how to combine the basic idea above with ScriptClip and ExportingSingleImage to make the script output the frames found marked with their framenumber ?

US$50 (via paypal) to the one who can help me out with a working solution !!

Tobias
Fudoh is offline   Reply With Quote
Old 31st May 2006, 15:07   #5  |  Link
hanfrunz
Registered User
 
hanfrunz's Avatar
 
Join Date: Feb 2002
Location: Germany
Posts: 536
look at the manual page of conditionalfilter. There is an example (Advanced conditional filtering: part II). This could be adapted to write the framenumbers of the dropouts to a text file. In a second script you can use conditionalreader and only extract the frames you need with imagewriter

could you upload a samplevideo?

hanfrunz

Last edited by hanfrunz; 31st May 2006 at 15:12.
hanfrunz is offline   Reply With Quote
Old 31st May 2006, 15:46   #6  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
else you might be able to make something out of this old thread:
http://forum.doom9.org/showthread.php?t=82066
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 5th June 2006, 23:12   #7  |  Link
Fudoh
Registered User
 
Join Date: Sep 2003
Posts: 15
Thanks to everybody contributing (@tsp: amazing script, but way too complicated for me to even understand it) !!

Here's the result:

#
# dropout.avs
#

# settings
global dir = "d:\temp\"
global infile = dir + "Capture_20060605-134049.avi"
global logfile = dir + "test.log"

# code
clip = AviSource(infile).ConvertToYV12

WriteFileIf(clip, logfile, "(UDifferenceFromPrevious>20)", "current_frame", """ ":" """, "UDifferenceFromPrevious")
WriteFileStart(logfile, """ "Start" """, append = false)
WriteFileEnd(logfile, """ "End" """)

ConvertToYUY2


Specials thanks to Marc W. for the input and the script

When this script is run in any Media Player or VDub it outputs all dropouts (framenumbers) into a log file.

The remaining question for me: is there a way to speed it up ? Or in other words: how can I run the script without rendering the actual video to an output ? When I run it in VDub with input and output disabled it runs through (at 25x speed), but doesn't find and dropouts - probably because no actual frames from the video are requested.

But shouldn't there be any way to have AVISynth process the script (here do the "UDifferenceFromPrevious" function on the video), but without outputting the actual video ??

Thanks,
Tobias
Fudoh is offline   Reply With Quote
Old 6th June 2006, 08:11   #8  |  Link
hanfrunz
Registered User
 
hanfrunz's Avatar
 
Join Date: Feb 2002
Location: Germany
Posts: 536
if you disable input+output no video will be rendered. Try VIDEO->Scan video streams for errors in VDUB. Or use a command line tool (see sticky-thread)

hanfrunz
hanfrunz is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:24.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.