How to zoom out and pan on a picture | Zooming out photo video effect

Опубликовано: 29 Август 2022
на канале: The FFMPEG guy
1,231
36

Today, we show how to zoom out and pan onto a picture. Zooming and panning allows to focus attention on a particular part of a photo, often at the center, but not always. All parameters used can be of course fully customized to suit your needs.

EXAMPLES
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
❶ Zooming out & panning from the top left of the picture (default)
→ ffmpeg -loop 1 -i input.jpg -vf "zoompan=z='if(lte(zoom,1.0),1.5,max(1.001,zoom-0.0022))':d=300:s=hd1080" -t 10 -pix_fmt yuv420p output01.mp4

with:
* -loop 1 -i = Creates a video loop …
* input.jpg = … with picture “input.jpg”…
* -t 10 = … that lasts 10 seconds…
* -vf = Starts now a video filter (vf)…
* zoomspan = … calling «zoompan» to create a zoom and pan video effect.
* z = … where the zoom value (z)…
* if(lte(zoom,1.0) = At start (default zoom = 1.0), so…
* 1.5 = … initializes the zoom factor at 1.5…
* max(1.001,zoom-0.0022)) = … then decreases the zoom by 0.0022 each time until it reaches 1.001.
* d=300 = Sets the effect to last 300 frames (10s)…
* s=hd1080 = … and the output to be 1080 Full HD.
* -pix_fmt yuv420p = Sets the Pixel format to yuv420p (for compatibility with Windows in my case)…
* output01.mp4 = … and outputs the result to “output01.mp4”

Panning and zooming in different directions is just a matter now of playing with the x and y values, like we will quickly show in the following 4 examples

❷ Zooming out & panning from the top right of the picture
→ ffmpeg -loop 1 -i input.jpg -vf "zoompan=z='if(lte(zoom,1.0),1.5,max(1.001,zoom-0.0028))':x='if(eq(x,0),0.5*iw,max(1,iw/zoom/2))':d=300:s=hd1080" -t 10 -pix_fmt yuv420p output02.mp4

with:
* x='if(eq(x,0),0.5*iw,max(1,iw/zoom/2))' = Decreases «x» horizontal position value by a zoom factor until it reaches 1. Note: iw = input width

❸ Zooming out & panning from the bottom left of the picture
→ ffmpeg -loop 1 -i input.jpg -vf "zoompan=z='if(lte(zoom,1.0),1.5,max(1.001,zoom-0.0024))':y=ih:d=300:s=hd1080" -t 10 -pix_fmt yuv420p output03.mp4

with:
* y=ih = Sets «y» vertical position value to video height (ih)

❹ Zooming out & panning from the bottom right of the picture
→ ffmpeg -loop 1 -i input.jpg -vf "zoompan=z='if(lte(zoom,1.0),1.5,max(1.001,zoom-0.0023))':x='if(eq(x,0),0.5*iw,max(1,iw/zoom/2))':y='if(eq(y,0),0.5*ih,max(1,ih/zoom/2))':d=300:s=hd1080" -t 10 -pix_fmt yuv420p output04.mp4

with:
* x='if(eq(x,0),0.5*iw,max(1,iw/zoom/2))' = Decreases «x» horizontal position value by a zoom factor.
* y='if(eq(y,0),0.5*ih,max(1,ih/zoom/2))' = Decreases «y» vertical position value by a zoom factor.

❺ Zooming out & panning from the center of the picture
→ ffmpeg -loop 1 -i input.jpg -vf zoompan=z='if(lte(zoom,1.0),1.5,max(1.001,zoom-0.0023))':x='max(1,iw/2-(iw/zoom/2))':y='max(1,ih/2-(ih/zoom/2))':d=300:s=hd1080' -t 10 -pix_fmt yuv420p output05.mp4

with:
* x='max(1,iw/2-(iw/zoom/2))' = Sets «x» horizontal position for zoomed out video to be centered.
* y='max(1,ih/2-(ih/zoom/2))' = Sets «y» vertical position for zoomed out video to be centered.

ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Catch up with the FFMPEG guy Channel
   • ALL THE VIDEOS FROM THE CHANNEL  
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
MUSIC
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Trips - Topher Mohr and Alex Elena
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
An FFMPEG question?
Ask the FFMPEG guy
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ


Смотрите видео How to zoom out and pan on a picture | Zooming out photo video effect онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь The FFMPEG guy 29 Август 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,231 раз и оно понравилось 36 людям.