tanersener/ffmpeg-video-slideshow-scripts

Zoom in and pan always at center

trungbq06 opened this issue · 9 comments

Hi @tanersener ,

I'm trying to use the effects described here https://ffmpeg.org/ffmpeg-filters.html#Examples-113 but it doesn't work.

I add x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'

to file zoom_in_and_pan_with_fade_in_out_one.sh but it doesn't work. Could you please help me with this?

Please use POSITION_NUMBER=2 on this line?

Thank you so much for your reply,

In my case, remove POSITION_FORMULA help me get happy results.

Great 👍

Hi @tanersener ,

I'm trying to make another animation with zoom in and pan filter. I don't want the raw image zoomin and pan. I just want the raw image move from left to right.

I think I will need to make some animation on [stream${c}raw] from line 77 in zoom_in_and_pan_with_fade_in_out_one.sh but cannot do that.

Would you please help me out?

# 4. PREPARE INPUTS & FADE IN/OUT PARTS section fits images to screen. If you don't apply zoom effect and move the image left/right then background color will be shown during the movement, similar to the beginning of Stack transitions. Is this what you want to implement?

No, that's not I want to implement.

I want to pan the raw image (left to right or right to left), while still blur background.

I changed line 67 to this:

FULL_SCRIPT+="[stream${c}blurred][stream${c}raw]overlay=x='-(overlay_w-${WIDTH})+(overlay_w-${WIDTH})*t/${IMAGE_DURATION}':y='if(gte(H,${HEIGHT}),0,overlay_h/2)',trim=duration=${IMAGE_DURATION},format=yuv420p[stream$((c+1))out];"

But the moving is too fast. How can I slow down it?

Line 67 controls SCREEN_MODE = 1. If you want to use blurred background you need to use SCREEN_MODE = 4 and update Line 78.

(main_w-overlay_w)/2 expression of overlay filter in Line 78 defines the horizontal position (x). It is currently fixed and defines the horizontal center. You need to update it.

FULL_SCRIPT+="[stream${c}blurred][stream${c}raw]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:format=rgb,setpts=PTS-STARTPTS,split=2[stream$((c+1))out1][stream$((c+1))out2];"

Thank you so much for your help.