PDA

View Full Version : replacing a set of frames with a static image


grumpygamer
3rd April 2008, 10:55
I have looked here and there on the forum for such a thread but nothing relevant to my case came up.

I am using JDL's replacerange and imagesource

here's the script:
a=mpeg2source("D:\PIBA_134002\VIDEO_TS\ep7.d2v",info=3).bicubicresize(640,480).ConvertToYUY2().assumeFPS(25)
image = JDL_ImageSource("d:\animadelLAGO.tif",0,0,25).bicubicresize(640,480).ConvertToYUY2().assumeFPS(25)
JDL_ReplaceRange(a,image,0)
return a

which does not work, although it SHOULD replace frame 0 at least...
I had a TON of errors this doesnt match that doesn't match (framerate, videoformat, ecc...) so i used the code above to put both elements in line.

If anyone could help it would be really nice
thanks in advance
-gg

Inventive Software
3rd April 2008, 12:32
Don't have ConvertToYUY2, use ConvertToYV12.

Your catch with that is you're adding "return a" at the end, and a is the video source.

Use "Return(JDL_ReplaceRange(a,image,0))"

grumpygamer
3rd April 2008, 20:10
thank you, that was a great suggestion.

I now am faced with another problem:
I can't MOVE everything I change... BING! Error!

Here's my script once more

mpeg2source("D:\PIBA_134002\VIDEO_TS\ep7.d2v",info=3)
ConvertToYV12()
assumeFPS(29.970)

#tfm(d2v="D:\PIBA_134002\VIDEO_TS\ep7.d2v")
#tdecimate(mode=1)
#a.colormatrix(interlaced=true,hints=true)
#a.tfm(d2v="D:\PIBA_134002\VIDEO_TS\ep7.d2v")
#a.tdecimate(mode=1)
#a.crop( 8, 0, -12, 0)
#dehalo_alpha()
#awarpsharp(4.0)

image = JDL_ImageSource("d:\animadelLAGO.tif",0,0).ConvertToYV12().assumeFPS(29.970)
JDL_ReplaceRange(last,image,0)
return JDL_ReplaceRange(last,image,0)

it works but

1. it only replaces 1 frame... I need to replace a set, so do I have to create an array of the same image? If so how do I do that?

2. This is a telecined ntsc source so i wish to put it to 23.976 via tdecimate, but the fps will never match (Big question marks here)

How can i resolve this?
-gg

Edit: ok i fixed point 2 but still don't know how to replace many frames...
any suggestions?

grumpygamer
4th April 2008, 07:33
can i do something like this?

x = JDL_ReplaceRange(last,image,1)
y = JDL_ReplaceRange(x,image,2)
z = JDL_ReplaceRange(y,image,3)

return z

i have no idea on how to dynamically make frames out of my tiff image...

Inventive Software
5th April 2008, 18:39
Actually, that one's easy, and is already in AviSynth. ;)

DuplicateFrame(clip, frames)


I've looked through what you're doing and it seems illogical. I think what you're far better off doing is something along the following:


#Your source video file
source=MPEG2Source("D:\PIBA_134002\VIDEO_TS\ep7.d2v",info=3).ConvertToYV12()

#Your image file
image=JDL_ImageSource("d:\animadelLAGO.tif",0,0).ConvertToYV12()

#Replace image for one part
replace=JDL_ReplaceRange(source,image,0)

#Duplicate your new replaced image
newsection=DuplicateFrame(replace,25)

Return(newsection)


If that doesn't give you what you're after, and from looking at that it's 50% there, check the AviSynth documentation, and add DeleteFrame on the section you want rid of.