Log in

View Full Version : Remove by blend frame question


Soulhunter
8th December 2003, 00:45
Sorry, but I have a noob question...

How could I produce a "blend" frame with Avisynth ???

Lets say I have a video with 100 frames, and I want to replace frame 20 with a 50/50 blend of the frames 19 & 21...

How should the script look like ???

Thanks in advance...

Bye

Didée
8th December 2003, 09:29
I once started out with the following function: "RepairSegment".
Actually, I never really finished it completely, but it should be useful as it is:
function RepairSegment (clip clp, int Last_Good_Before, int First_Good_After)
{
part1 = clp.trim( 0, Last_Good_Before - 1)
part2 = clp.trim( First_Good_After + 1, 0)
repair1 = trim(Last_Good_Before - 1, Last_Good_Before). \
loop( (First_Good_After - Last_Good_Before), 1, 1). \
trim(1,0)
repair2 = trim(First_Good_After, First_Good_After + 1). \
loop( (First_Good_After - Last_Good_Before), 1, 1) . \
trim( 1,0 )
repair = dissolve( repair1, repair2, (First_Good_After - Last_Good_Before - 1) )

return( part1 + repair + part2 )
}
I'm not even sure if it's correctly working for 1-frame-replacements ... by that time, I was fighting with several "only-1-frame" problems in AviSynth, if you get me ;)

The intention is, like the function name proposes: replace a range of frames with a sliding blending from [the last good frame before the broken range] to [the first good frame after the broken range].

- Didée

Soulhunter
8th December 2003, 18:32
function RepairSegment (clip clp, int Last_Good_Before, int First_Good_After)
{
part1 = clp.trim( 0, Last_Good_Before - 1)
part2 = clp.trim( First_Good_After + 1, 0)
repair1 = trim(Last_Good_Before - 1, Last_Good_Before). \
loop( (First_Good_After - Last_Good_Before), 1, 1). \
trim(1,0)
repair2 = trim(First_Good_After, First_Good_After + 1). \
loop( (First_Good_After - Last_Good_Before), 1, 1) . \
trim( 1,0 )
repair = dissolve( repair1, repair2, (First_Good_After - Last_Good_Before - 1) )

return( part1 + repair + part2 )
}
Uhm... Big thanks for it !!!

But I'm not that advanced with complex Avisynth scripts... :(

So, could you give me an example script for my 100 frame example above ???

Would be very nice... ;)

Bye

scharfis_brain
9th December 2003, 12:01
I think, that didee's function is a little bit "oversized" for your needs.

use this script for testing:

function blendframe(clip a, int blend)
{
a.trim( 0, blend - 1) +
\layer(a.trim(blend-1,blend-1),a.trim(1+blend,1+blend),"fast") +
\a.trim( blend + 1,0)
}

xxxsource("yourvideo.xxx")
blendframe(20)

this will give you exactly, what you wanted.

Soulhunter
9th December 2003, 21:45
Thanks, I will try it... :)

Bye