Log in

View Full Version : ImageSource with different step


pixaeiro
31st October 2014, 14:44
Hello,
I am creating a video from a screen capture I have in PNG files. I am using ImageSource for this. This is a sample of my script:
-----------------------
v00 = ImageSource( "C:/VideoSamples/AviSynthScripts/ImgsBad/i%02d.bmp", 0, 100, 25.0 )
audio = WAVSource( "C:/VideoSamples/Material/Audio/1.PixaFluxIs.wav" )
AudioDub( v00, audio )
-----------------------
This creates a video with images i00.bmp i01.bmp i02.bmp ...

What I'd like to do is to use a step option to skip frames, for example:
-----------------------
v00 = ImageSource( "C:/VideoSamples/AviSynthScripts/ImgsBad/i%02d.bmp", 0, 100, 25.0, step = 2 )
audio = WAVSource( "C:/VideoSamples/Material/Audio/1.PixaFluxIs.wav" )
AudioDub( v00, audio )
-----------------------
Would use frames: i00.bmp i02.bmp i04.bmp ...

Is this possible? If not, is there any other function that allows me to do this?

Thank you

poisondeathray
31st October 2014, 14:47
-----------------------
Would use frames: i00.bmp i02.bmp i04.bmp ...

Is this possible? If not, is there any other function that allows me to do this?





coronasequence() has a gapless mode that can skip missing frame

pixaeiro
31st October 2014, 14:49
AWESOME... Thank you!
I'll give it a try!!!

poisondeathray
31st October 2014, 15:33
I may have misinterpreted what you were asking

Just to be clear, coronasequence's gapless=true skips missing frames that are physically missing . This is useful for things like CGI preview renders that can take hours per frame, and you often skip every nth frame on the render

If you have the full image sequence present (ie. 0,1,2,3....) , and only want to select every nth frame, you can use one of avisynth's select functions, like selecteven() for 0,2,4.... . With SelectEvery() you have more options like step size, offset

http://avisynth.nl/index.php/Select

pixaeiro
31st October 2014, 17:16
Yes, SelectEvery is exactly what I need! I'll give it a try tomorrow!
Thank You very much!

pixaeiro
1st November 2014, 03:01
SelectEvery works very well when all clips have the same step-size, but when I mix clips with different step sizes I get errors.

For example, this script works perfectly:


# Logo
v00 = ImageSource( "E:/VideoFactory/Capture/intro/intro-%05d.png", 0, 300, 30 )
v00 = SelectEvery( v00, 2, 0 )

# Intro
v01 = ImageSource( "E:/VideoFactory/Capture/intro/intro-%05d.png", 500, 800, 30 )
v01 = SelectEvery( v01, 2, 0 )

video = v00 + v01
audio = WAVSource( "E:/VideoFactory/Audio/WhatIs.wav" )
AudioDub( video, audio )


But this script with a different step-size for v00 fails:


# Logo
v00 = ImageSource( "E:/VideoFactory/Capture/intro/intro-%05d.png", 0, 300, 30 )
v00 = SelectEvery( v00, 1, 0 )

# Intro
v01 = ImageSource( "E:/VideoFactory/Capture/intro/intro-%05d.png", 500, 800, 30 )
v01 = SelectEvery( v01, 2, 0 )

video = v00 + v01
audio = WAVSource( "E:/VideoFactory/Audio/WhatIs.wav" )
AudioDub( video, audio )


With this error message:


Splice: Video framerate doesn't match
(C:\VideoSamples\AviSynthScripts\ImgsStep\script temp files\script_Source.avs, line 9)


Am I doing something wrong? Can I 'fix' the frame rates somehow?

Thank you!

poisondeathray
1st November 2014, 03:20
Use AssumeFPS(some number) after each, and use the same common value

AssumeFPS keeps the same number of frames, it just slows down or speeds up the video . Therefore you would have to adjust the audio as well

Obviously a larger step size will be "sped up" more compared to the lower step size version with the same assumed FPS

foxyshadis
1st November 2014, 11:23
And it should be noted that the 30 at the end of your ImageSource lines is the framerate. If you want some segments to be all frames and some to be every-other, you can freely mix ImageSource(......, 30) and ImageSource(......, 60).SelectEvery(2, 0)