VideoHelp Forum




+ Reply to Thread
Results 1 to 22 of 22
  1. Hi, please help me cat


    I'm not able to zoompan on photo with ffmpeg
    can someone help a cat, please thanks. I'm desperate cat:

    Image
    [Attachment 89238 - Click to enlarge]


    and this is my background:

    Image
    [Attachment 89239 - Click to enlarge]


    I need to do a "simple" zoom in, slightly, in batch when possible

    The target frame size should be 1920x1080 and have to have the still background, and zoom the overlaid cat.jpg in the centre of a video, smooth.
    I try some commandline but I cannot get a result


    I try:

    Code:
    ffmpeg.exe -y -i "w:\cat.jpg" -vf "scale=10*iw:10*ih,zoompan=z='if(between(it, 0, 1), 1+2*sin(it*PI/2),if(between(it, 1, 2), 3,if(between(it, 2, 3), 3-2*sin((it-2)*PI/2), 1)))':x='iw*0.25-(iw*0.25/zoom)':y='ih*0.15-(ih*0.15/zoom)':d=1:s=1280x720:fps=30" -y v:\output.mp4
    
    ffmpeg.exe -y -loop 1 -i "w:\cat.jpg" -ss 0 -t 10 -filter_complex "nullsrc=size=1920x1080 [bg]; [0] scale=300x300,zoompan=z=zoom+(0.1/30) [fg]; [bg][fg] overlay=x=(1920-w)/2:y=(1080-h)/2:shortest=1 " "out.mp4"
    
    ffmpeg.exe -y -loop 1 -i "w:\cat.jpg" -ss 0 -t 10 -filter_complex "nullsrc=size=1920x1080 [bg]; [0] scale=19200:10800 [fg]; [bg][fg] overlay=x=(W-w)/2:y=(H-h)/2" -ss 0 -t 10 "v:\out.mp4"
    
    ffmpeg.exe -y -i w:\cat -i w:\cat.jpg -filter_complex "[0:v]scale=8000:-1,zoompan=z='min(zoom+0.0015,1.5)':d=417:s=578x870,setsar=1[v0]; [1:v]scale=8000:-1,zoompan=z='if(lte(zoom,1.0),1.5,max(1.021,zoom-0.0020))':d=417:s=578x870,setsar=1,fade=t=in:st=0:d=5[v1];[v0][v1]concat=n=2:v=1:a=0,format=yuv420p[v]" -c:v libx264 -map "[v]" -t 300 -threads 2 video.mp4
    
    
    ffmpeg.exe -y -i w:cat.jpg -i w:\cat.jpg -filter_complex "[0:v]scale=8000:-1,zoompan=z='min(zoom+0.0015,1.5)':d=417:s=578x870,setsar=1[v0]; [1:v]scale=8000:-1,zoompan=z='if(lte(zoom,1.0),1.5,max(1.021,zoom-0.0020))':d=417:s=578x870,setsar=1,fade=t=in:st=0:d=5[v1];[v0][v1]concat=n=2:v=1:a=0,format=yuv420p[v]" -c:v libx264 -map "[v]" -t 300 -threads 2 video.mp4
    
    
    
    
    ffmpeg.exe -y  -i "despcat.jpg"  -y -t 15 -t 15 -i "v:\cane2.jpg" -t 15 -filter_complex "[0:v]scale=8000:-1,zoompan=z='min(zoom+0.0020,1.5)':d=417[v0]; [1:v]zoompan=z='if(lte(zoom,1.0),1.5,max(1.021,zoom-0.0020))':d=417,fade=t=in:st=0:d=5[v1];[v0][v1]concat=n=2:v=1:a=0,format=yuv420p[v]" -c:v libx264 -map "[v]" -s "800x450" -t 300 -threads 2 video.mp4
    
    v:\FFPEG771\ffmpeg.exe -y -i v:\despcat.jpg -i v:\despcat.jpg -filter_complex "[0:v]scale=8000:-1,zoompan=z='min(zoom+0.0015,1.5)':d=417:s=800x450,setsar=1[v0]; [1:v]scale=8000:-1,zoompan=z='if(lte(zoom,1.0),1.5,max(1.021,zoom-0.0020))':d=417:s=800x450,setsar=1,fade=t=in:st=0:d=5[v1];[v0][v1]concat=n=2:v=1:a=0,format=yuv420p[v]" -c:v libx264 -map "[v]" -t 300 -threads 2 video.mp4
    
    
    ffmpeg.exe -y -i v:\despcat.jpg -i v:\despcat.jpg -filter_complex "[0:v]scale=8000:-1,zoompan=z='min(zoom+0.0015,1.5)':d=417:s=578x870,setsar=1[v0]; [1:v]scale=8000:-1,zoompan=z='if(lte(zoom,1.0),1.5,max(1.021,zoom-0.0020))':d=417:s=578x870,setsar=1,fade=t=in:st=0:d=5[v1];[v0][v1]concat=n=2:v=1:a=0,format=yuv420p[v]" -c:v libx264 -map "[v]" -t 300 -threads 2 video.mp4
    
    forse ma aumentando di 1/3 W H dell'immagine
    v:\FFPEG771\ffmpeg.exe -y -i v:\despcat.jpg -i v:\despcat.jpg -filter_complex "[0:v]scale=8000:-1,zoompan=z='min(zoom+0.0015,1.5)':d=417:s=578x870,setsar=1[v0]; [1:v]scale=8000:-1,zoompan=z='if(lte(zoom,1.0),1.5,max(1.021,zoom-0.0020))':d=417:s=578x870,setsar=1,fade=t=in:st=0:d=5[v1];[v0][v1]concat=n=2:v=1:a=0,format=yuv420p[v]" -c:v libx264 -map "[v]" -t 300 -threads 2 video.mp4
    
    
    ffmpeg.exe  -t 5 -i "w:\cat.jpg" -vf "format=yuv444p,scale=8000:-2,zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=300:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':s=1920x1080:fps=50,format=yuv420p" -preset ultrafast -t 16 -framerate 50 -y 1.mp4
    
    ffmpeg.exe -loop 1 -r 50 -i "w:\cat.JPG" -vf "scale=10*iw:10*ih,pad=w=9600:h=6000:x='(oh-iw)/2':y='(oh-ih)/2',zoompan=z='if(between(it, 0, 1), 1+2*sin(it*PI/2),if(between(it, 1, 2), 3,if(between(it, 2, 3), 3-2*sin((it-2)*PI/2), 1)))':x='iw*0.25-(iw*0.25/zoom)':y='ih*0.15-(ih*0.15/zoom)':d=1:s=1280x720:fps=50" -t 3.5 -y out.mp4
    but no results

    can someone have new ideas?
    Last edited by marcorocchini; 23rd Oct 2025 at 10:50.
    Quote Quote  
  2. Edit: For anyone reading this thread in the future, cropping values should always be specified as float when using Animate(), assuming a resizer is doing the cropping. See post #16.

    I have no clue when it comes to ffmpeg, but what about Avisynth?

    If you use the CropResize function in my signature, you don't have to fuss too much about cropping to exactly the same aspect ratio as the output dimensions, because the function won't let you distort the picture. You can move across the picture as well as zoom, depending on the beginning and ending cropping you specify.

    cat preview:

    A = last
    Animate(0,99, "PCropResize", A, 1280,720, 200,0,0,0, A, 1280,720, 300,100,-450,-300)

    cat zoom:

    A = last
    Animate(0,99, "CropResize", A, 1280,720, 200,0,0,0, A, 1280,720, 300,100,-450,-300)

    The examples in the YouTube video all seem to be zooming in on the whole image, background included, so it'd be easier to overlay them first.

    Your images zoomed:

    A = ImageSource("cat.jpg")
    B = ImageSource("background.jpg")
    Overlay(B, CropResize(A, 724,1080), 598).Trim(0,99)
    C = last
    Animate(0,99, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 350,0,-350,-200)

    You could do the zooming before overlaying it on the background so the background isn't zoomed, but I think it'd look better if they're zoomed together.

    Edit:
    A simpler method? You can adjust the brightness and contrast etc of the borders if need be.

    ImageSource("cat.jpg")
    ConvertToYV12()
    A = CropResize(1920,1080, Frosty=true).Trim(0,99)
    Animate(0,99, "CropResize", A, 1920,1080, 0,0,0,0, A, 1920,1080, 350,0,-350,-200)
    Image Attached Files
    Last edited by hello_hello; 21st Oct 2025 at 11:48.
    Quote Quote  
  3. Kawaiiii
    Join Date
    May 2021
    Location
    Italy
    Search Comp PM
    Originally Posted by hello_hello View Post
    I have no clue when it comes to ffmpeg, but what about Avisynth?
    If you search for his messages.. he always ask very weird question, to do apparently purposeless things with the less adequate tool to boot.

    I think he likes to experiment weird stuff
    Quote Quote  
  4. Code:
    Import("v:\AviSynth\CropResize\CropResize 2025-06-16.avsi")
    Import("v:\AviSynth\CropResize\CropResize Resizer Functions 2025-06-16.avsi")
    Import("v:\AviSynth\CropResize\CropResize Wrapper Functions 2025-06-16.avsi")
    
    A = ImageSource("v:\cat.jpg")
    B = ImageSource("v:\background.jpg")
    Overlay(B, CropResize(A, 724,1080), 598).Trim(0,99)
    C = last
    Animate(0,99, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 350,0,-350,-200)
    wowc*at"

    however I have already another question: can the start and finish point be a little movement "smooth"?

    Although in most cases, neither the start nor the end movement are used during a possible editing, it's potentially useful to have these as well, but "smoothed" speed. Is it possible to integrate this into the avisynth script?

    and how to tell to avisynth it have output 50P?
    Quote Quote  
  5. If it's not totally smooth it's probably because I zoomed a bit too much or too quickly relative to the frame rate. If the zoom was over 200 frames instead of 100 it should look smoother.

    ImageSource outputs the image at 24fps, but it's a still image so you could change the frame rate with AssumeFPS(50) before anything else. If you run out of frames, use could use Loop() to add more followed by Trim() if need be. Edit: Thinking about it, ChangeFPS(50) should work just as well as it duplicates frames, and it's a still picture if you add it before Animate().

    If you want the start and end to zoom a little slower than the rest, you'd have to use more than one Animate(), I assume, and it'd take a bit of experimenting to get it right. Animate works on the specified frame range though, so for a 150 frame picture you could have 25 still frames before the zooming starts and 25 still frames after by not including them.

    Trim(0, 149)
    Animate(25,124, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 350,0,-350,-200)
    Last edited by hello_hello; 19th Oct 2025 at 13:56.
    Quote Quote  
  6. So, a new edit to my batch, if it possible to do this: I'd like the cat's image to remain still for the first 5 seconds, then zoom in, keep zoomed static and then zoom out
    Quote Quote  
  7. You'd have to change the Trim ranges accordingly as it's only static for a couple of seconds, but zooming in and out would look like this, I guess.

    A = ImageSource("cat.jpg")
    B = ImageSource("background.jpg")
    Overlay(B, CropResize(A, 724,1080), 598)

    ChangeFPS(50)

    C = last
    D = C.Trim(0,99)
    E = Animate(0,149, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 350,0,-350,-200).Trim(0,149)
    F = C.CropResize(1920,1080, 350,0,-350,-200).Trim(0,49)
    G = Animate(0,149, "CropResize", C, 1920,1080, 350,0,-350,-200, C, 1920,1080, 0,0,0,0).Trim(0,149)

    D + E + F + G + D
    Image Attached Files
    Last edited by hello_hello; 20th Oct 2025 at 02:19.
    Quote Quote  
  8. Originally Posted by hello_hello View Post

    D + E + F + G + D



    w*wcat

    Essentially is the target.

    it would be interesting if there was a function that softens, a little bit, the start and end of the movement but it still remains usable in any case
    Quote Quote  
  9. I think I still zoomed a little too quickly, although at least it's smooth at 50fps. If you slow the zoom down though (do it over more frames) I don't think the start of the movement would need softening, but I gave it a try...

    You need to get the zoom range and speed correct first. I used the preview function to see what the cropping would be at frames 5 and 6, then used those values in animate while slowing the initial zoom down so it took 11 frames to zoom as much as it was previously zooming in 6 frames. Hopefully that makes sense. For example I found the cropping values for frames 5 and 6 using the cropping preview for this animation:

    Animate(0,299, "pCropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 350,0,-350,-200).Trim(0,299)

    I did a similar thing for the second zoom and the end result was this:

    A = ImageSource("cat.jpg")
    B = ImageSource("background.jpg")
    Overlay(B, CropResize(A, 724,1080), 598)
    ChangeFPS(50)

    C = last
    D = C.Trim(0,99)
    E = Animate(0,10, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 6,0,-6,-3).Trim(0,10)
    F = Animate(0,299, "CropResize", C, 1920,1080, 7,0,-7,-4, C, 1920,1080, 350,0,-350,-200).Trim(0,299)
    G = C.CropResize(1920,1080, 350,0,-350,-200).Trim(0,99)
    H = Animate(0,10, "CropResize", C, 1920,1080, 350,0,-350,-200, C, 1920,1080, 344,0,-344,-197).Trim(0,10)
    I = Animate(0,299, "CropResize", C, 1920,1080, 343,0,-343,-196, C, 1920,1080, 0,0,0,0).Trim(0,299)

    D + E + F + G + H + I + D
    ConvertToYV12()

    but it's hard to preview because Avisynth seems to slow to a crawl when there's more than one Animate() in a script, it's hard to get right, and it's probably not worth it.
    Image Attached Files
    Quote Quote  
  10. If you care, doing the whole lot in 16 bit and then dithering seems to help with the banding in the background image. Slower though, although if you convert to YUV420 before Animate it's a little quicker.

    A = ImageSource("N:\cat.jpg")
    B = ImageSource("N:\background.jpg")
    Overlay(B, CropResize(A, 724,1080), 598)
    ChangeFPS(50)
    Trim(1,1).ConvertBits(16).Loop(1000)

    C = last
    D = C.Trim(0,99)
    E = Animate(0,10, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 6,0,-6,-3).Trim(0,10)
    F = Animate(0,299, "CropResize", C, 1920,1080, 7,0,-7,-4, C, 1920,1080, 350,0,-350,-200).Trim(0,299)
    G = C.CropResize(1920,1080, 350,0,-350,-200).Trim(0,99)
    H = Animate(0,10, "CropResize", C, 1920,1080, 350,0,-350,-200, C, 1920,1080, 344,0,-344,-197).Trim(0,10)
    I = Animate(0,299, "CropResize", C, 1920,1080, 343,0,-343,-196, C, 1920,1080, 0,0,0,0).Trim(0,299)

    D + E + F + G + H + I + D
    ConvertToYUV420().GradFun3Plus().ConvertBits(8, Dither=0)
    Image Attached Files
    Quote Quote  
  11. Or maybe something like this if it works for most images. It's definitely quicker, although the texture in the borders does seem to require more bits to encode.

    ImageSource("N:\cat.jpg")
    FrostyB(Gamma=0.9, Blend=0.5, Cont=0.8)
    ConvertFPS(50)
    Trim(1,1).ConvertToYUV420().CropResize(1920,1080, Frosty=true).Loop(1000)

    C = last
    D = C.Trim(0,99)
    E = Animate(0,10, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 6,0,-6,-3).Trim(0,10)
    F = Animate(0,299, "CropResize", C, 1920,1080, 7,0,-7,-4, C, 1920,1080, 350,0,-350,-200).Trim(0,299)
    G = C.CropResize(1920,1080, 350,0,-350,-200).Trim(0,99)
    H = Animate(0,10, "CropResize", C, 1920,1080, 350,0,-350,-200, C, 1920,1080, 344,0,-344,-197).Trim(0,10)
    I = Animate(0,299, "CropResize", C, 1920,1080, 343,0,-343,-196, C, 1920,1080, 0,0,0,0).Trim(0,299)

    D + E + F + G + H + I + D
    Image Attached Files
    Last edited by hello_hello; 20th Oct 2025 at 05:08.
    Quote Quote  
  12. Image
    [Attachment 89288 - Click to enlarge]


    Code:
    GradFun3Plus
    needed, where I can download?


    and

    Code:
    Import("v:\AviSynth\CropResize\CropResize 2025-06-16.avsi")
    Import("v:\AviSynth\CropResize\CropResize Resizer Functions 2025-06-16.avsi")
    Import("v:\AviSynth\CropResize\CropResize Wrapper Functions 2025-06-16.avsi")
    
    LoadPlugin("v:\AviSynth\neo_f3kdb\x64\neo-f3kdb.dll")
    LoadPlugin("V:\AviSynth\neo_f3kdb\x64\dither.dll")
    LoadPlugin("V:\AviSynth\neo_f3kdb\x64\avstp.dll")
    
    Import("V:\AviSynth\neo_f3kdb\x64\dither.avsi")
    Import("V:\AviSynth\neo_f3kdb\x64\mt_xxpand_multi.avsi")
    
    Import("v:\AviSynth\FrostyBorders 2025-04-14\FrostyBorders Avisynth\FrostyBorders 2025-04-14.avsi")
    
    A = ImageSource("v:\cat.jpg")
    FrostyB(Gamma=0.9, Blend=0.5, Cont=0.8)
    ConvertFPS(50)
    Trim(1,1).ConvertToYUV420().CropResize(1920,1080, Frosty=true).Loop(1000)
    
    C = last
    D = C.Trim(0,99)
    E = Animate(0,10, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 6,0,-6,-3).Trim(0,10)
    F = Animate(0,299, "CropResize", C, 1920,1080, 7,0,-7,-4, C, 1920,1080, 350,0,-350,-200).Trim(0,299)
    G = C.CropResize(1920,1080, 350,0,-350,-200).Trim(0,99)
    H = Animate(0,10, "CropResize", C, 1920,1080, 350,0,-350,-200, C, 1920,1080, 344,0,-344,-197).Trim(0,10)
    I = Animate(0,299, "CropResize", C, 1920,1080, 343,0,-343,-196, C, 1920,1080, 0,0,0,0).Trim(0,299)
    
    D + E + F + G + H + I + D
    need also FrostyB
    Last edited by marcorocchini; 20th Oct 2025 at 16:07.
    Quote Quote  
  13. i the meantime I have try:


    Code:
    A = ImageSource("v:\cat.jpg")
    B = ImageSource("v:\background.jpg")
    
    Overlay(B, CropResize(A, 724,1080), 598)
    ChangeFPS(50)
    Trim(1,1).ConvertBits(16).Loop(1000)
    
    C = last
    D = C.Trim(0,99)
    E = Animate(0,10, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 6,0,-6,-3).Trim(0,10)
    F = Animate(0,299, "CropResize", C, 1920,1080, 7,0,-7,-4, C, 1920,1080, 350,0,-350,-200).Trim(0,299)
    G = C.CropResize(1920,1080, 350,0,-350,-200).Trim(0,99)
    H = Animate(0,10, "CropResize", C, 1920,1080, 350,0,-350,-200, C, 1920,1080, 344,0,-344,-197).Trim(0,10)
    I = Animate(0,299, "CropResize", C, 1920,1080, 343,0,-343,-196, C, 1920,1080, 0,0,0,0).Trim(0,299)
    
    D + E + F + G + H + I + D
    ConvertToYUV422().ConvertBits(8, Dither=0)
    it seems almost "ok" but if possibile to add more "depth" to the zoomIN excursion
    Quote Quote  
  14. Edit: marcorocchini, please make sure you also read post #16.

    FrostyB() is included with CropResize. It creates global variables for specifying options when Frosty=true for CropResize. It doesn't do anything else. I didn't want to add a lot of extra arguments to CropResize for configuring the frosty borders, so the FrostyB function configures them instead.

    CropResize can create the frosty borders itself (the function is built in) but you can also use the stand-alone version of the function you've downloaded. It doesn't have as many options for resizing, but it still crops and resizes the same way and both functions should add identical borders. FrostyBorders doesn't have a cropping preview though, so it'd be easier to use CropResize for the animated parts.

    ImageSource("N:\cat.jpg")
    ConvertFPS(50)
    Trim(1,1).ConvertToYUV420().FrostyBorders(1920,1080, Gamma=0.9, Blend=0.5, Cont=0.8).Loop(1000)

    There's two versions of GradFun3Plus, but I think the only difference is their dependencies.
    https://github.com/Dogway/Avisynth-Scripts/blob/master/EX%20mods/GradFun3plus.avsi
    https://github.com/Dogway/Avisynth-Scripts/blob/master/MIX%20mods/GradFun3plus.avsi

    As a side note, if you happen to encode 8 bit video as 10 bit, sometimes it prevents more banding if you convert to 10 bit, but still dither to 8 bit, like this:

    ConvertBits(16).GradFun3Plus().ConvertBits(10, Dither=0, Dither_Bits=8)

    You can add more depth to the zoom or change it to do whatever you want. Just change the cropping amount and use the cropping preview to see what's happening (the way the picture is cropped isn't always intuitive when the specified cropping doesn't result in the same aspect ratio as the output width and height, as CropResize will adjust the cropping so as not to distort the picture).
    Last edited by hello_hello; 21st Oct 2025 at 12:00.
    Quote Quote  
  15. By the way, if it's of any use to you, frosty borders has options for cloning the sides of the picture into the borders. Clone=3 uses an upscaled version of the picture for the borders as it was designed for video/images with a "cell phone" aspect ratio. You may or may not like it, but you can adjust the brightness and color etc. I changed the default values here so you can easily see what it does (and I adjusted the cropping for you so it zooms in a bit more).

    ImageSource("cat.jpg")
    ConvertFPS(50)
    Trim(1,1)
    ConvertToYUV420(matrix="rec709") # is that the correct matrix?

    FrostyB(Clone=3, Feather=4, Gamma=0.75, Blur=20)
    C = CropResize(1920,1080, Frosty=true).Loop(1000)

    D = C.Trim(0,99)
    E = Animate(0,10, "CropResize", C, 1920,1080, 0,0,0,0, C, 1920,1080, 6,0,-6,-3).Trim(0,10)
    F = Animate(0,289, "CropResize", C, 1920,1080, 7,0,-7,-4, C, 1920,1080, 430,0,-430,-160).Trim(0,289)
    G = C.CropResize(1920,1080, 430,0,-430,-160).Trim(0,99)
    H = Animate(0,10, "CropResize", C, 1920,1080, 430,0,-430,-160, C, 1920,1080, 423,0,-423,-157).Trim(0,10)
    I = Animate(0,289, "CropResize", C, 1920,1080, 421,0,-421,-157, C, 1920,1080, 0,0,0,0).Trim(0,289)

    D + E + F + G + H + I + D
    Image Attached Files
    Last edited by hello_hello; 21st Oct 2025 at 11:59.
    Quote Quote  
  16. marcorocchini,

    It's been quite a while since I've used the Animate function, and I forgot something important. If you supply a function argument as an integer, Animate will calculate new values for it and round them to an integer. In this case CropResize was converting the cropping values back to float, but it still means Animate wasn't specifying the cropping as accurately as possible in any of my examples above, and possibly making the zooming slightly jittery at times (especially at lower frame rates).

    The upshot is.... the cropping should always be specified as float, even when the values specified are whole numbers. It means ideally you wouldn't use the Crop() function with Animate(), but crop with a resizer instead. Here's the difference, using the same start and end cropping as for most of the above examples, only specified as float.

    (0.0, 0.0, 0.0, 0.0) -> (350.0, 0.0, -350.0, -200.0)
    (350.0, 0.0, -350.0, -200.0) - > (0.0, 0.0, 0.0, 0.0)

    ImageSource("cat.jpg")
    ConvertFPS(50)
    Trim(1,1)
    ConvertToYUV420(matrix="rec709")

    FrostyB(Clone=3, Feather=4, Gamma=0.75, Blur=20)
    C = CropResize(1920,1080, Frosty=true).Loop(1000)

    D = C.Trim(0,99)
    E = Animate(0,10, "CropResize", C, 1920,1080, 0.0, 0.0, 0.0, 0.0, C, 1920,1080, 5.853, 0.0, -5.853, -3.344).Trim(0,10)
    F = Animate(0,299, "CropResize", C, 1920,1080, 7.023, 0.0, -7.023, -4.013, C, 1920,1080, 350.0, 0.0, -350.0, -200.0).Trim(0,299)
    G = C.CropResize(1920,1080, 350.0, 0.0, -350.0, -200.0).Trim(0,99)
    H = Animate(0,10, "CropResize", C, 1920,1080, 350.0, 0.0, -350.0, -200.0, C, 1920,1080, 344.147, 0.0, -344.147, -196.656).Trim(0,10)
    I = Animate(0,299, "CropResize", C, 1920,1080, 342.977, 0.0, -342.977, -195.987, C, 1920,1080, 0.0, 0.0, 0.0, 0.0).Trim(0,299)

    D + E + F + G + H + I + D
    Image Attached Files
    Last edited by hello_hello; 21st Oct 2025 at 12:26.
    Quote Quote  
  17. hope I didn't commit a crime on your script but if possible I need a background rather soft, dark and blurry to leave more focus on the central cat, so no clone, and based on my(cat) an absolutely irrational choice, at least for now also no feather



    and also if possible more zoomed but I don't know where to adjust the value, also the script should come out globally from me in YUY2 8 bit but I'm not shure if is correct my script

    however I try this:

    Code:
    ImageSource("v:\cat.jpg")
    ConvertFPS(50)
    Trim(1,1)
    ConvertToYUY2(interlaced=false, matrix="rec709")
    
    FrostyB(Feather=0, Gamma=0.75, Blur=20)
    C = CropResize(1920,1080, Frosty=true).Loop(1000)
    
    D = C.Trim(0,99)
    E = Animate(0,10, "CropResize", C, 1920,1080, 0.0, 0.0, 0.0, 0.0, C, 1920,1080, 5.853, 0.0, -5.853, -3.344).Trim(0,10)
    F = Animate(0,299, "CropResize", C, 1920,1080, 7.023, 0.0, -7.023, -4.013, C, 1920,1080, 350.0, 0.0, -350.0, -200.0).Trim(0,299)
    G = C.CropResize(1920,1080, 350.0, 0.0, -350.0, -200.0).Trim(0,99)
    H = Animate(0,10, "CropResize", C, 1920,1080, 350.0, 0.0, -350.0, -200.0, C, 1920,1080, 344.147, 0.0, -344.147, -196.656).Trim(0,10)
    I = Animate(0,299, "CropResize", C, 1920,1080, 342.977, 0.0, -342.977, -195.987, C, 1920,1080, 0.0, 0.0, 0.0, 0.0).Trim(0,299)
    
    D + E + F + G + H + I + D
    so summarizing:

    more zoomed, and a background blurred not cloned and if possibile without grain and "clean"

    and if the total duration can be increased, at least I have 18 seconds of video in total here, but if it were possible, I would prefer the initial image to remain still for 5 seconds, then the first zoom movement (the speed is fine) but with a deeper zoom, when the image freezes, then another 4/5 seconds of still, and then the zoom back out. Overall, the total duration could even be increased to 25 seconds.

    Another issue that however seems not to be very important would be the moment of start and finish if it were possible should be something like soft start and soft end, that is the opposite of a pure mechanical movement, almost a kind of "spline" apply only to the startpoint and endpoint. This however seems to depend on Animate as far as I understand and however it shouldn't be that crucial at the moment.

    So .. how should the script be modified for all this? THANKSS

    and... if possible:it would be nice if in the same session, the zoomin/zoomout movement can be repeat 3 timesne slow, one normal
    Last edited by marcorocchini; 21st Oct 2025 at 20:03.
    Quote Quote  
  18. At 50fps, 5 seconds is 250 frames, so.....

    Code:
    D = C.Trim(0, 249)
    The same applies to the zoom, if you want a zoom to last for 5 seconds

    Code:
    E = Animate(0,249, "CropResize", C, 1920,1080, 0.0, 0.0, 0.0, 0.0, C, 1920,1080, 350.0, 0.0, -350.0, -200.0).Trim(0, 249)
    For the depth of the zoom, use the cropping preview on the image to find the cropping that'll give you the desired amount of zoom and use those values for cropping in Animate.

    Code:
    CropResize(1920,1080, 430.0, 0.0, -430.0, -160.0, CPreview=2)
    Cropping 430 pixels from each side will obviously zoom in further than cropping 350 pixels each side, but check it with the preview as you'll need to adjust the top and/or bottom cropping so the picture you want to keep is in the centre.

    As I explained earlier, you can slow the initial part of each zoom with Animate. Assuming the above cropping and duration is correct and you want the first 10 frames of the zoom to take twice as long, use the cropping preview to find the appropriate cropping for frames 9 and 10.

    Code:
    Animate(0, 249, "pCropResize", C, 1920,1080, 0.0, 0.0, 0.0, 0.0, C, 1920,1080, 430.0, 0.0, -430.0, -160.0).Trim(0, 249)
    For this example they're:
    15.542, 0.0, -15.542, -5.783
    and
    17.269 0.0, -17.269, -6.426

    Now add an extra Animate so the same amount of cropping/zoom is applied over 20 frames rather than 10, and reduce the second animation by 20 frames.

    Code:
    D = C.Trim(0, 249)
    E = Animate(0, 19, "CropResize", C, 1920,1080, 0.0, 0.0, 0.0, 0.0, C, 1920,1080, 15.542, 0.0, -15.542, -5.783).Trim(0, 19)
    F = Animate(0, 229, "CropResize", C, 1920,1080, 17.269, 0.0, -17.269, -6.426, C, 1920,1080, 430.0, 0.0, -430.0, -160.0).Trim(0, 229)
    D + E + F
    If you find the cropping values for frames 9 and 10 using this Animation:

    Code:
    Animate(0, 249, "pCropResize", C, 1920,1080, 430.0, 0.0, -430.0, -160.0, C, 1920,1080, 0.0, 0.0, 0.0, 0.0).Trim(0, 249)
    You'll find they're:
    414.458, 0.0, -414.458, -154.217
    and
    412.731, 0.0, -412.731, -153.576

    So to put it all together (I converted to YV12 but you can convert to YV16 and finally to YUY2 if you prefer):

    Code:
    A = ImageSource("N:\cat.jpg")
    B = ImageSource("N:\background.jpg")
    
    Overlay(B, CropResize(A, 724,1080), 598)
    ChangeFPS(50)
    
    C = Trim(1, 1).ConvertToYV16(matrix="rec709").ConvertBits(16).Loop(1000)
    
    D = C.Trim(0, 249)
    
    E = Animate(0, 19, "CropResize", C, 1920,1080, 0.0, 0.0, 0.0, 0.0, C, 1920,1080, 15.542, 0.0, -15.542, -5.783).Trim(0, 19)
    F = Animate(0, 229, "CropResize", C, 1920,1080, 17.269, 0.0, -17.269, -6.426, C, 1920,1080, 430.0, 0.0, -430.0, -160.0).Trim(0, 229)
    
    G = C.Trim(0, 249).CropResize(1920,1080, 430.0, 0.0, -430.0, -160.0)
    
    H = Animate(0, 19, "CropResize", C, 1920,1080, 430.0, 0.0, -430.0, -160.0, C, 1920,1080, 414.458, 0.0, -414.458, -154.217).Trim(0, 19)
    I = Animate(0, 229, "CropResize", C, 1920,1080, 412.731, 0.0, -412.731, -153.576, C, 1920,1080, 0.0, 0.0, 0.0, 0.0).Trim(0, 229)
    
    J = D + E + F + G + H + I
    
    J + J + J + D
    # Zoom in and out 3 times, but you'll have to create a different animation set if you want the zooms to have different speeds
    
    GradFun3Plus().ConvertBits(8, Dither=0).ConvertToYUY2()
    The Animate function animates in a linear way, so the above method is the only way I can think of to soften the beginning of the zooms a tad. As long as you don't over-do it so the change in zoom speed becomes noticeable, which it is for the example above, so maybe I should have stretched the first 10 frames over 15 frames instead of 20, or the first 8 frames over 12, or something like that...
    Image Attached Files
    Last edited by hello_hello; 21st Oct 2025 at 23:42.
    Quote Quote  
  19. Image
    [Attachment 89341 - Click to enlarge]


    so the last script assumes that the background is given, however what's not clear to me is if I enter files with different resolutions as the source, even portraits, will I still be able to get the same zoom percentage?

    I tryed

    G = C.Trim(0, 249).CropResize(1920,1080, 430.0, 0.0, -430.0, -160.0, CPreview=2)

    Image
    [Attachment 89342 - Click to enlarge]


    in virtualdub but exactly I cannot manage this values

    hello_hello please help the cat: can you put a script with a more zoom factor only for the first or the second take-out

    and

    J + J + J + D

    means that J is replicated 3 times?

    if possible I need 5 or 6 or 7 version with different speed/zoom so I can quickly choose what works best when I'm in a hurry.

    Regarding the fact that Animate can only work in linear mode: at this point, perhaps it's better to accept that the start and stop are worked on a few frames around the point (perhaps 10 are too many?) so as not to have an overall movement that's too mechanical even though I can't ask for a better smoothie.

    So what can it be the script ?
    Last edited by marcorocchini; 22nd Oct 2025 at 09:21.
    Quote Quote  
  20. Originally Posted by marcorocchini View Post
    so the last script assumes that the background is given, however what's not clear to me is if I enter files with different resolutions as the source, even portraits, will I still be able to get the same zoom percentage?
    The zoom is based purely on the cropping you specify, so for different sized images you'd probably want to specify different cropping to change the zoom.

    There's also the problem of automating the overlay when the foreground images are different sizes, but Avisynth can calculate it for you.
    Assuming the background image will always be 1920x1080, or resized to 1920x1080 before Overlay is used.

    Code:
    A = ImageSource("N:\cat.jpg")
    B = ImageSource("N:\background.jpg")
    
    # The width of clip A will be Mod4 and calculated automatically
    
    A = A.CropResize(0,1080)
    B = B.CropResize(1920,1080)
    
     # Ensure "Position" is Mod2
    
    Position = floor((1920 - width(A)) / 4.0) * 2
    
    Overlay(B, A, Position)
    
    # Check the values for the foreground picture width,
    # the total border width, and the left picture placement
    
    subtitle(string(width(A)) + "\n" + string(1920 - width(A)) + "\n" + string(Position), align=5, size=50, lsp=20)
    Originally Posted by marcorocchini View Post
    I tryed

    G = C.Trim(0, 249).CropResize(1920,1080, 430.0, 0.0, -430.0, -160.0, CPreview=2)

    Image
    [Attachment 89342 - Click to enlarge]


    in virtualdub but exactly I cannot manage this values
    In your screenshot the yellow area shows the cropping you specified:
    430.0, 0.0, -430.0, -160.0
    The zoomed picture has to be 16:9 though (1920x1080), so the blue area shows the extra cropping the function applied to make it 16:9.
    The actual cropping being applied is shown as "Total Cropping", which is:
    430.0, 161.875, -430.0, -321.875
    Change CPreview=2 to CPreview=0 or remove the CPreview argument to see the zoomed result.

    What I did initially was specify left and right cropping of 430, but the zoomed area needed to be moved up a bit, so specifying -160 for the bottom cropping caused the function to crop more from the bottom than the top.

    Originally Posted by marcorocchini View Post
    hello_hello please help the cat: can you put a script with a more zoom factor only for the first or the second take-out

    G = C.Trim(0, 249).CropResize(1920,1080, 430.0, 0.0, -430.0, -160.0, CPreview=2)
    Just increase or decrease the left and right cropping to change the zoom, and adjust the bottom cropping as need be so the remaining picture is what you want it to be.

    Originally Posted by marcorocchini View Post
    J + J + J + D

    means that J is replicated 3 times?
    Yes

    Originally Posted by marcorocchini View Post
    if possible I need 5 or 6 or 7 version with different speed/zoom so I can quickly choose what works best when I'm in a hurry.
    You'll have to create 5 or 6 versions and pick the appropriate one. It might be easier to create a function. Here's a template function for you:

    Code:
    function Zoom(clip V, int "Type") {
    
    Type = default(Type, 1)
    
    if (Type == 1) {
    
    A = V.Trim(0, 249)
    B = Animate(0, 9, "CropResize", V, 1920,1080, 0.0,0.0,0.0,0.0, V, 1920,1080, 6.0,0.0,-6.0,-3.0).Trim(0, 9)
    C = Animate(0, 239, "CropResize", V, 1920,1080, 7.0,0.0,-7.0,-4.0, V, 1920,1080, 350.0,0.0,-350.0,-200.0).Trim(0, 239)
    D = V.CropResize(1920,1080, 350,0,-350,-200).Trim(0, 249)
    E = Animate(0, 9, "CropResize", V, 1920,1080, 350.0,0.0,-350.0,-200.0, V, 1920,1080, 344.0,0.0,-344.0,-197.0).Trim(0, 9)
    F = Animate(0, 239, "CropResize", V, 1920,1080, 343.0,0.0,-343.0,-196.0, V, 1920,1080, 0.0,0.0,0.0,0.0).Trim(0, 239)
    
    Zoomed = A + B + C + D + E + F + A }
    
    else if (Type == 2) {
    
    A = V.Trim(0, 249)
    B = Animate(0, 9, "CropResize", V, 1920,1080, 0.0,0.0,0.0,0.0, V, 1920,1080, 6.0,0.0,-6.0,-3.0).Trim(0, 9)
    C = Animate(0, 239, "CropResize", V, 1920,1080, 7.0,0.0,-7.0,-4.0, V, 1920,1080, 350.0,0.0,-350.0,-200.0).Trim(0, 239)
    D = V.CropResize(1920,1080, 350,0,-350,-200).Trim(0, 249)
    E = Animate(0, 9, "CropResize", V, 1920,1080, 350.0,0.0,-350.0,-200.0, V, 1920,1080, 344.0,0.0,-344.0,-197.0).Trim(0, 9)
    F = Animate(0, 239, "CropResize", V, 1920,1080, 343.0,0.0,-343.0,-196.0, V, 1920,1080, 0.0,0.0,0.0,0.0).Trim(0, 239)
    
    Zoomed = A + B + C + D + E + F + A }
    
    else if (Type == 3) {
    
    A = V.Trim(0, 249)
    B = Animate(0, 9, "CropResize", V, 1920,1080, 0.0,0.0,0.0,0.0, V, 1920,1080, 6.0,0.0,-6.0,-3.0).Trim(0, 9)
    C = Animate(0, 239, "CropResize", V, 1920,1080, 7.0,0.0,-7.0,-4.0, V, 1920,1080, 350.0,0.0,-350.0,-200.0).Trim(0, 239)
    D = V.CropResize(1920,1080, 350,0,-350,-200).Trim(0, 249)
    E = Animate(0, 9, "CropResize", V, 1920,1080, 350.0,0.0,-350.0,-200.0, V, 1920,1080, 344.0,0.0,-344.0,-197.0).Trim(0, 9)
    F = Animate(0, 239, "CropResize", V, 1920,1080, 343.0,0.0,-343.0,-196.0, V, 1920,1080, 0.0,0.0,0.0,0.0).Trim(0, 239)
    
    Zoomed = A + B + C + D + E + F + A }
    
    else {
    
    A = V.Trim(0, 249)
    B = Animate(0, 9, "CropResize", V, 1920,1080, 0.0,0.0,0.0,0.0, V, 1920,1080, 6.0,0.0,-6.0,-3.0).Trim(0, 9)
    C = Animate(0, 239, "CropResize", V, 1920,1080, 7.0,0.0,-7.0,-4.0, V, 1920,1080, 350.0,0.0,-350.0,-200.0).Trim(0, 239)
    D = V.CropResize(1920,1080, 350,0,-350,-200).Trim(0, 249)
    E = Animate(0, 9, "CropResize", V, 1920,1080, 350.0,0.0,-350.0,-200.0, V, 1920,1080, 344.0,0.0,-344.0,-197.0).Trim(0, 9)
    F = Animate(0, 239, "CropResize", V, 1920,1080, 343.0,0.0,-343.0,-196.0, V, 1920,1080, 0.0,0.0,0.0,0.0).Trim(0, 239)
    
    Zoomed = A + B + C + D + E + F + A }
    
    return Zoomed }
    Obviously each zoom in the function above is exactly the same. It'll be up to you to change them for the zooms you need. Once that's done and the function is loaded though, all you'll need to do to zoom is specify the appropriate zoom number for the function:

    Code:
    A = ImageSource("N:\cat.jpg")
    B = ImageSource("N:\background.jpg")
    
    A = A.CropResize(0,1080)
    B = B.CropResize(1920,1080)
    
    Position = floor((1920 - width(A)) / 4.0) * 2
    
    Overlay(B, A, Position)
    
    ChangeFPS(50).Trim(1, 1).Loop(999)
    
    Zoom(2)
    Originally Posted by marcorocchini View Post
    Regarding the fact that Animate can only work in linear mode: at this point, perhaps it's better to accept that the start and stop are worked on a few frames around the point (perhaps 10 are too many?) so as not to have an overall movement that's too mechanical even though I can't ask for a better smoothie.

    So what can it be the script ?
    It's really up to you. You'll have to experiment a bit.
    Last edited by hello_hello; 22nd Oct 2025 at 13:11.
    Quote Quote  
  21. Code:
    # The width of clip A will be Mod4 and calculated automatically
    ?

    so I cannot use the square cat 861x861 as input?

    Image
    [Attachment 89349 - Click to enlarge]


    or the line is adjusting all?

    however

    after so much efforts this is an example of script:
    Code:
    A = ImageSource("v:\cat.jpg")
    B = ImageSource("v:\background.jpg")
    
    # The width of clip A will be Mod4 and calculated automatically
    
    A = A.CropResize(0,1080)
    B = B.CropResize(1920,1080)
    
    # Ensure "Position" is Mod2
    
    Position = floor((1920 - width(A)) / 4.0) * 2
    Overlay(B, A, Position)
    
    # Check the values for the foreground picture width,
    # the total border width, and the left picture placement
    
    #subtitle(string(width(A)) + "\n" + string(1920 - width(A)) + "\n" + string(Position), align=5, size=50, lsp=20)
    
    ChangeFPS(50)
    
    C = Trim(1, 1).ConvertToYV16(matrix="rec709").ConvertBits(16).Loop(1000)
    
    D = C.Trim(0, 249)
    
    E = Animate(0, 13, "CropResize", C, 1920,1080, 0.0, 0.0, 0.0, 0.0, C, 1920,1080, 15.542, 0.0, -15.542, -5.783).Trim(0, 13)
    F = Animate(0, 229, "CropResize", C, 1920,1080, 17.269, 0.0, -17.269, -6.426, C, 1920,1080, 430.0, 0.0, -430.0, -160.0).Trim(0, 229)
    
    G = C.Trim(0, 249).CropResize(1920,1080, 430.0, 0.0, -430.0, -160.0)
    
    H = Animate(0, 13, "CropResize", C, 1920,1080, 430.0, 0.0, -430.0, -160.0, C, 1920,1080, 414.458, 0.0, -414.458, -154.217).Trim(0, 13)
    I = Animate(0, 229, "CropResize", C, 1920,1080, 412.731, 0.0, -412.731, -153.576, C, 1920,1080, 0.0, 0.0, 0.0, 0.0).Trim(0, 229)
    
    J = D + E + F + G + H + I
    
    J + J + J + D
    # Zoom in and out 3 times, but you'll have to create a different animation set if you want the zooms to have different speeds
    
    GradFun3Plus().ConvertBits(8, Dither=0).ConvertToYUY2()
    I replace E = Animate(0, 19 with E = Animate(0, 13

    Please be patient but I need to procede step by step: how can I get an higher zoom factor in this case? Wouldn't it be better to include a zoom factor calculation system that automatically adjusts the values?

    can I simply define as global variable a sort of zoomfactor and zoomspeed so the script is regulated to this values?

    Last edited by marcorocchini; 22nd Oct 2025 at 14:51.
    Quote Quote  
  22. so I wonder: can I set a sort of ZoomFactor and ZoomSpeed that define they without manual calculate the values?
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!