Alphamerge filter only works on first frame

Alphamerge filter only works on first frame

I am trying to implement blur filter over specific non rectangle object, I have mask and sample video but the issue is that alphamerge result of first frame of video is applied to the whole video(Like you overlayed a static image over the whole length of video) I used the following command

ffmpeg -y -i sample_video.mp4 -i masked_image.png -filter_complex 
"[0:v][1:v]alphamerge,boxblur=16[alf];[0:v][alf]overlay[v]" -map [v] -map 0:a -c:a copy -preset ultrafast test.mp4

sample_video.mp4 masked_image.png

UPDATE: Your solution is working quite well but now blur intensity value is not effecting blur intensity

Mask Image

Sample Image

Result with boxblur=10

Result with boxblur=30

Antwort1

Your mask is a single image so it won't track the subject, but I assume your issue is that the overlay pixels are static. You'll need to loop the mask since alphamerge terminates with the shortest input, and the overlay will repeat the last frame of the secondary input.

ffmpeg -y -i sample_video.mp4 -loop 1 -i masked_image.png ...

verwandte Informationen