Log in

View Full Version : A Script to Generate Slideshow with TransAll effects


bigboss97
18th January 2009, 13:00
I'm playing around with avisynth to create a slideshow with TransAll (http://avisynth.org/vcmohan/TransAll/docs/index.html) effects, see also (http://forum.videohelp.com/topic339076.html).

I've created a DOS batch file ShowGen.bat which generates from a given directory a slideshow of all JPG-files:
ShowGen C:\\photos

First, all JPG-file paths are written into a file images.fdt. Then folksDATA (http://www.huaonline.com/folksDATA) processes the FDT-files. At the end, the file slideshow.avs is generated.

folksDATA is a tool which I've written for other purpose. All these are created for my own use and hope someone will find them useful.

Phuoc Can HUA

mikeytown2
19th January 2009, 02:16
ImageMagick Reader (http://forum.doom9.org/showthread.php?t=135928) would be a better starting point. It will load a dir and resize it. Then all thats needed is frame length manipulation & transitions.

bigboss97
19th January 2009, 02:49
Thanks for that, that's what I need because I've noticed that the performance of my script is terrible. I guess that it's resizing each single frame at the moment.

I went through the link below somehow I couldn't find avisynth script example or tutorial for immaread/write.

Do I need to write it back to a file and use ImageSource() on it?
or I can use the converted image directly from memory?

ImageMagick Reader (http://forum.doom9.org/showthread.php?t=135928) would be a better starting point. It will load a dir and resize it. Then all thats needed is frame length manipulation & transitions.

mikeytown2
19th January 2009, 02:54
Here's the homepage for it
http://www.geocities.com/wilbertdijkhof/
Direct link
http://www.geocities.com/wilbertdijkhof/immaavs_v141.zip

Future reference for finding plugins/filters
http://avisynth.org/mediawiki/External_filters


btw the link is about 2/3 the way down on the first post.

bigboss97
23rd January 2009, 14:14
I've tried immaavs.dll and got the error LoadPlugin: unable to load "immaavs.dll". Then I checked:
http://forum.doom9.org/archive/index.php/t-135928.html

It sounds like I need more than just one DLL. Since I only need it for resize I'd better leave it for the moment. So, I optimize my function:

function Image2Clip( string FName, int ImgLen)
{
# B= KillAudio( BlankClip( ImgLen, ScrWidth, ScrHeight, color=$001144, pixel_type="RGB24"))
# C= ImageSource( FName).trim(1, ImgLen)
B= KillAudio( BlankClip( 1, ScrWidth, ScrHeight, color=$001144, pixel_type="RGB24"))
C= ImageSource( FName)

ImgIsWide=( (C.Width/ C.Height) >= (ScrWidth/ ScrHeight))? 1: 0
Fact=( ImgIsWide== 1)? 1.0 *ScrWidth/ C.Width: 1.0 *ScrHeight/ C.Height
NewWidth= Round( Fact* C.Width)
NewHeight= Round( Fact* C.Height)
O= C.BilinearResize( NewWidth, NewHeight)
return B.Overlay( O, (ScrWidth-NewWidth)/2, (ScrHeight-NewHeight)/2).Loop( ImgLen)
}

Now I Loop through one resized image, instead of resize each frame. The speed is now much better :)

I've noticed that the performance of my script is terrible. I guess that it's resizing each single frame at the moment.

Gavino
23rd January 2009, 16:20
ImgIsWide=( (C.Width/ C.Height) >= (ScrWidth/ ScrHeight))? 1: 0
Fact=( ImgIsWide== 1)? 1.0 *ScrWidth/ C.Width: 1.0 *ScrHeight/ C.Height

When doing aspect ratio calculations, you must ensure divisions are done on floating point values, not integers, or you will get the wrong answer. Also, you can express the condition better by making ImgIsWide a boolean variable.

ImgIsWide = float(C.Width)/C.Height >= float(ScrWidth)/ScrHeight
Fact= ImgIsWide ? 1.0 *ScrWidth/C.Width : 1.0 *ScrHeight/C.Height

mikeytown2
24th January 2009, 03:51
@bigboss97

You might want to tryout Zoombox for your resizing, it takes care of all the Aspect Ratio math for you.
http://forum.doom9.org/showthread.php?p=1111789#post1111789

bigboss97
24th January 2009, 12:20
No doubt, Ken Burns effect will make my slideshow alive.
Since I'm trying to use Avisynth in realtime (preview mode) I can only afford limited number of filters.

Certainly, I don't need to run two filters overlapped. Ken-Bruns will run between the transition filters. I'm just an AVS-beginner. I'll leave this for the moment. Unless someone can give me few lines example.

Thanks
Phuoc Can HUA

@bigboss97

You might want to tryout Zoombox for your resizing, it takes care of all the Aspect Ratio math for you.
http://forum.doom9.org/showthread.php?p=1111789#post1111789