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 Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th January 2009, 13:00   #1  |  Link
bigboss97
Registered User
 
Join Date: Jul 2008
Posts: 31
A Script to Generate Slideshow with TransAll effects

I'm playing around with avisynth to create a slideshow with TransAll effects, see also.

I've created a DOS batch file ShowGen.bat which generates from a given directory a slideshow of all JPG-files:
Code:
ShowGen C:\\photos
First, all JPG-file paths are written into a file images.fdt. Then 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
Attached Files
File Type: zip folksSHOW.zip (131.1 KB, 31 views)
bigboss97 is offline   Reply With Quote
Old 19th January 2009, 02:16   #2  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
ImageMagick Reader would be a better starting point. It will load a dir and resize it. Then all thats needed is frame length manipulation & transitions.
mikeytown2 is offline   Reply With Quote
Old 19th January 2009, 02:49   #3  |  Link
bigboss97
Registered User
 
Join Date: Jul 2008
Posts: 31
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?

Quote:
Originally Posted by mikeytown2 View Post
ImageMagick Reader would be a better starting point. It will load a dir and resize it. Then all thats needed is frame length manipulation & transitions.
bigboss97 is offline   Reply With Quote
Old 19th January 2009, 02:54   #4  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Here's the homepage for it
http://www.geocities.com/wilbertdijkhof/
Direct link
http://www.geocities.com/wilbertdijk...maavs_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.
mikeytown2 is offline   Reply With Quote
Old 23rd January 2009, 14:14   #5  |  Link
bigboss97
Registered User
 
Join Date: Jul 2008
Posts: 31
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:
Code:
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

Quote:
Originally Posted by bigboss97 View Post
I've noticed that the performance of my script is terrible. I guess that it's resizing each single frame at the moment.
bigboss97 is offline   Reply With Quote
Old 23rd January 2009, 16:20   #6  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,407
Quote:
Originally Posted by bigboss97 View Post
Code:
	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.
Code:
	ImgIsWide = float(C.Width)/C.Height >= float(ScrWidth)/ScrHeight
	Fact= ImgIsWide ? 1.0 *ScrWidth/C.Width : 1.0 *ScrHeight/C.Height
Gavino is offline   Reply With Quote
Old 24th January 2009, 03:51   #7  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
@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.ph...89#post1111789
mikeytown2 is offline   Reply With Quote
Old 24th January 2009, 12:20   #8  |  Link
bigboss97
Registered User
 
Join Date: Jul 2008
Posts: 31
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

Quote:
Originally Posted by mikeytown2 View Post
@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.ph...89#post1111789
bigboss97 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 18:04.


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