ffmpeg

How to insert background video using ffmpeg


I have a video.mp4 (640x360) and image.jpg (1280x720). I want to make image.jpg as a background of video.mp4 using ffmpeg:

enter image description here


Solution

  • You can loop input image and use overlay filter. Example command:

    ffmpeg -loop 1 -i image.jpg -i video.mp4 -filter_complex "overlay=(W-w)/2:(H-h)/2:shortest=1,format=yuv420p" -c:a copy output.mp4