ffmpeg: overlay video on top of a cropped video, map the overlay audio, cut the base video to the overlays length
I’m trying to overlay a video on top of a base video which is cropped to a shorts video format (standing phone). The overlayed video should be centered on top of the base layer. The base video’s length should be reduced to the overlay’s length. And I want to save only the overlay’s audio.
I’ve tried a bunch of stuff without much success. The current state of my ffmpeg command is this:
ffmpeg -i overlay.mp4 -ss 00:00:00 -to <insert base length?> -i base.mp4 -map 1:v:0 -map 1:a -vf "crop=ih*(9/16):ih" -crf 21 output.mp4
But this only gives me the cropped version of the base video. So my questions are:
- How can I figure out the base video’s length?
- How can I actually overlay (not map) other video on top of the base video?
- How can I map the overlay’s audio? Since
-map 1:athe base’s audio and-map 0:asays: “Stream map ‘0:a’ matches no streams. To ignore this, add a trailing ‘?’ to the map.”
Any help is appreciated.
Read more here: Source link
