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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 5th April 2020, 14:16   #1  |  Link
PerDeConf
Registered User
 
Join Date: Dec 2017
Posts: 4
Append a still image respecting aspect ratio and possibly adding borders

I'm looking to append a still image to a video clip.
I found an old thread that deals with this issue.
Unfortunately I'm facing distortion problems and can't adapt the script.

Gavino mentioned at the time that this script should be improved...

Quote:
the photo is narrower than the video. When the photo is wider, you want to add borders on the top and bottom instead of the sides
Depending on the initial size of the video, the image is exaggeratedly distorted making its content unreadable.

Can someone show me the way because abstraction is not my strong point? (such scripts probably already exist)



Code:
v=DirectShowSource("F:\Vidéos\Enfants\Minuscule\gay-minus.avi")




pic="D:\pic\screenshot_395.png"
t=10 #[time in sec]
fc=Round(t*FrameRate(v)) #frame count

####################################################
# Option Zoom
d=20 # start zooming
n = 50 # no of frames for still
endzoom = 4.0
####################################################

ImageSource(pic).ConvertToRGB32()
AssumeFPS(v).Loop().Trim(0,fc-1)
#~ Animate(last, d, 119, "SimpleZoomBox", 1.0, 0, 0, endzoom, (endzoom * -0.10), (endzoom * 0.9))      # Option Zoom
AudioDub(BlankClip(v, length=t))
fv=last # frozen vid

vasr=float(v.Height)/float(v.Width) #video aspect ratio
pasr=float(fv.Height)/float(fv.Width) #picture aspect ratio
nW=INT(fv.Width*(pasr*vasr)) #new Width
xx=(v.Width-nW) #sum of the lateral borders
Spline36Resize(nW, v.Height).AddBorders(xx/2,0,xx/2,0)

#~ ConvertToYV12()

#~ v ++ last  #joining both clips
last #only for picture clip
PerDeConf is offline   Reply With Quote
 

Tags
aspect ratio, avisynth, still image

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 03:16.


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