I'm trying to overlay one video on top of another using FFMPEG, in the exact same format as FaceTime, but the video would have rounded corners. I've tried the commands on other posts but they all generate unexpected results or errors.
Here is the command that overlays the videos decently:
-i main_video.mp4 -i small_overlaid_video_in_lower_left_corner.mp4 -filter_complex \
"[0:v]scale=iw:ih[main_scaled]; \
[1:v]scale=iw/2:ih/2:force_original_aspect_ratio=decrease,format=yuva420p[reaction_resized]; \
[main_scaled][reaction_resized]overlay=x=40:y=H-h-40:format=auto[final]" \
-map "[final]" -map 1:a? -c:a copy -c:v libx264 -crf 18 -preset ultrafast -t -y output.mp4
The problems this has is that the main videos resolution varies from video to video, so sometimes the overlaid video is super small and sometimes its too big. Three questions:
- How do I make the overlaid video the same size in comparison to the main video every time?
- How can I apply rounded corners on the rectangle?
- How can I modify it to include both video's audio?