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 Development
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th July 2003, 23:40   #1  |  Link
FredThompson
Registered User
 
FredThompson's Avatar
 
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,984
conditional choice of frame from 2 streams

I'm looking for a way to conditionally choose frames from one of two streams based on scene change detection. It doesn't have to be absolutely perfect.

Here's the thought:

Starting with a raw source stream, establish a second stream through a filter.

A test is done such that frame X comes from the filtered stream unless a test of frame X+n shows a scene change. This allows a way to reduce the unwanted effects of temporal smoothing across scene changes.

If Donald Graft's Dup is modified such that it would, if instructed, return only a boolean for change detection given the frames X and X+n, this would be fairly easy from a user standpoint. The regular Dup functionality could be used to tune configuration for a given source.

Construction of the output stream would, essentially, be choosing frames from either input stream based on the state switch of the boolean.

Questions:

1) Is there a filter which provides scene change detection for a specified frame and returns a boolean?

2) If so, how would a stream be constructed from two source streams?
__________________
Reclusive fart.
Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers

Last edited by FredThompson; 8th July 2003 at 23:44.
FredThompson is offline   Reply With Quote
Old 9th July 2003, 01:22   #2  |  Link
FredThompson
Registered User
 
FredThompson's Avatar
 
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,984
ok, I've tracked this issue down to the ConditionalFilter. From this page:

http://www.avisynth.org/index.php?pa...ditionalFilter

There is an example in the middle of the page:
Quote:
Example (this will replace the last frame before a scenechange with the first frame after the scenechange):

ConditionalFilter(last, last, last.trim(1,0), "YDifferenceToNext()", ">", "10", true)
That's pretty close to what I'm looking for. The only difference is I want to replace the last frame before the scene change with the source frame. That particular frame won't have the temporal filter but at least it should be sharper.

If there's a way to use temporalsoften such that the source frame isn't affected by the scene change frame, that would be cool. Hope that makes sense.

FWIW, here's the filter I'm trying to modify:

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")
__________________
Reclusive fart.
Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers
FredThompson is offline   Reply With Quote
Old 9th July 2003, 01:39   #3  |  Link
bilu
Registered User
 
bilu's Avatar
 
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
The frame_number variable may help.

http://forum.doom9.org/showthread.ph...378#post332378


Bilu
bilu is offline   Reply With Quote
Old 9th July 2003, 02:05   #4  |  Link
FredThompson
Registered User
 
FredThompson's Avatar
 
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,984
Yeah, it might, thanks.

The filter I've shown above will work on an entire stream. The only thing it's doing which I/d like to change is how it processes the final frame before a scene change.

Thanks, I'll do some more research.
FredThompson is offline   Reply With Quote
Old 9th July 2003, 09:27   #5  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
It's difficult to help you, without trying myself. But does something like this work:

clip_u = [unfiltered clip]
cilp_f = [filtered clip]
ConditionalFilter(clip_u, clip_f, clip_u, "YDifferenceToNext()", ">", "10", true)

edit: corrected small mistake

Last edited by Wilbert; 9th July 2003 at 10:29.
Wilbert is offline   Reply With Quote
Old 9th July 2003, 18:49   #6  |  Link
FredThompson
Registered User
 
FredThompson's Avatar
 
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,984
That's what I was thinking lately.

Leave the current algorithm alone because it filters quite well. Use another ConditionalFilter to chose between its stream or the original.

I'd started with bilu's idea then realized what a style mistake I'd made by planning to alter the filter.

Thanks for the feedback.
FredThompson is offline   Reply With Quote
Reply


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 00:33.


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