How to scale some overlay image in ffmpeg - ffmpeg

ffmpeg -i tmp3.mp4 -i sucai/s4.jpg -i sucai/s1.mp4 -filter_complex "[1]scale=500:500[b];[0][b]overlay=x=0:y=0:enable='between(t,0,5)',overlay=x=0:y=0:enable='between(t,8,15)'" o.mp4 -y
This command can only process the first inserted picture, and will not work for the second one.
could you help me?
thank you for your help

Add another scale, use ; instead of , to join non-linear sets of filters, and consider adding shortest=1 to the last overlay:
ffmpeg -i tmp3.mp4 -i sucai/s4.jpg -i sucai/s1.mp4 -filter_complex "[1]scale=500:500[b];[2]scale=500:500[c];[0][b]overlay=x=0:y=0:enable='between(t,0,5)'[bg];[bg][c]overlay=x=0:y=0:enable='between(t,8,15)':shortest=1" o.mp4

Related

How to apply any mask.png on a video with ffmpeg

I am adding a 1.mp4 on a video 2.mp4, and i want to add a mask on overlay video(1.mp4)
I want to apply this mask on 1.mp4
I'm using chrome key right now
ffmpeg -t 5 -r 30 -f lavfi -i color=c=black:s=640x360
-i 1.mp4
-i mask2.png
-i 2.mp4
-filter_complex "
[1:v]scale=500x281[v1];
[2]scale=500x281[mask];
[v1][mask]overlay, chromakey=0x00FF00:0.25:0.08 [v2];
[3:v]scale=640x360[v3];
[0][v3]overlay [out1];
[out1][v2]overlay=0:0"
-y output.mp4
But it also removes color from videos.
I'm not sure but i think it can be done by negate
also i don't need audio command, i already done that part
Thanks

FFmpeg format error when using alphaextract

I'm trying to mask an image using a png circle
When I use alphaextract, I get this error:
The following filters could not choose their formats: Parsed_alphaextract_X
Here's my command:
ffmpeg -i "https://i.imgur.com/aZkbbWn.jpeg" -i "https://i.imgur.com/jVNCqIj.png" -filter_complex "[0]scale=200:200[ava];[1]scale=200:200,alphaextract[alfa];[ava][alfa]alphamerge" circle_ava.png
I tried adding format=yuv420p, to input [1] but it didn't help
I also tried adding -pix_fmt yuv420p as the first parameter, but no luck
Any help is appreciated
I fixed it with format=rgba
ffmpeg -i "https://i.imgur.com/aZkbbWn.jpeg" -i "https://i.imgur.com/jVNCqIj.png" -filter_complex "[0]scale=200:200[ava];[1]scale=200:200,format=rgba,alphaextract[alfa];[ava][alfa]alphamerge" circle_ava.png

Scale and overlay in single command

I want to convert and resize a video and put a logo on it. I am doing this with 2 different command line like this.
Command 1:
D:\Logo\ffmpeg -i "D:\Logo\video.mxf" -vf scale=1280:720 "D:\Logo\video.mxf_fullHDtoHD.mp4"
Command 2:
D:\Logo\ffmpeg -i "D:\Logo\video.mxf_fullHDtoHD.mp4" -i D:\Logo\logo_720p.png -filter_complex "[0:v][1:v] overlay=60:50" "D:\Logo\output_720p_with_logo.mp4"
Can I do this in just one command?
Combined command:
ffmpeg -i "D:\Logo\video.mxf" -i D:\Logo\logo_720p.png -filter_complex "[0:v]scale=1280:720[bg];[bg][1:v]overlay=60:50" "D:\Logo\output_720p_with_logo.mp4"

FFMPEG Add 2 watermarks to an Image using single command

How to add 2 watermarks to one image using ffmpeg. This is the command I am using for adding single watermark
ffmpeg -i actual-image.jpg -i watermark.png -filter_complex "overlay=5:5" output.jpg
But i am not able to add 2 arguments for this. Thanks for help in advance
Apply 2 overlays. The 2nd overlay will use the result of the first overlay as its base input.
ffmpeg -i actual-image.jpg -i watermark1.png -i watermark2.png -filter_complex "[0][1]overlay=5:5[vid1];[vid1][2]overlay=300:300" output.jpg

add multiple overlays to a single image with ffmpeg

How am I supposed to add two transition animations to the same image in the video with ffmpeg command? I want the image to slide from left to right and after a while back from right to left... This command is for left to right
ffmpeg -i input.mp4 -i image.png -filter_complex "[0:v][1:v]overlay=x='min(-1.5*w+5*w*t,5)':y=H/2-h/2'" -y output.mp4
There are two methods to do this. One is to provide a clipped oscillating function, similar to the expression for x used in the drawtext filter here.
The other method is use a conditional expression, shown below.
ffmpeg -i input.mp4 -i image.png
-filter_complex
"[0:v][1:v]overlay=x='if(lt(t,8),min(-1.5*w+5*w*t,5),5-5*w*(t-8))':y=H/2-h/2'"
-y output.mp4
Here's the slide out starts at t=8s.

Resources