For example,
Could you pls share the ffmpeg command to concatenate the jpeg and video? I tried -hstack
and -xstack
filters. But, couldn't get the video inside the rectangle.
TIA
Your rectangle has a size of 910x400, so you have to downscale the 1280x720 video to fit. But the aspect ratios do not match. So you need to also pad or crop the 1280x720 video to properly fit inside 910x400 if you want to preserve the aspect ratio.
Combine these answers:
ffmpeg -i image.jpg -i video.mp4 -filter_complex "[1]scale=910:400:force_original_aspect_ratio=increase,crop=910:400[fg];[0][fg]overlay=x=490:y=100,format=yuv420p" -c:a copy -movflags +faststart output.mp4
ffmpeg -i image.jpg -i video.mp4 -filter_complex "[1]scale=910:400:force_original_aspect_ratio=decrease,pad=910:400:-1:-1[fg];[0][fg]overlay=x=490:y=100,format=yuv420p" -c:a copy -movflags +faststart output.mp4
This will ignore the aspect ratio and will result in a distorted image.
ffmpeg -i image.jpg -i video.mp4 -filter_complex "[1]scale=910:400,setsar=1[fg];[0][fg]overlay=x=490:y=100,format=yuv420p" -c:a copy -movflags +faststart output.mp4