FFmpeg - Overlay one video on another video?

I understand that this is a very open question. I did some initial reading in FFmpeg , but now some guidance is required.

Problem

  • I have a video input.mov.
  • I would like to overlay another video on top overlay.wov.
  • The result should be one video ( output.mov).

Notes

Thanks - C.

edits

  • Backend - Go / Ruby. Open to use a new language.
  • Sound from the first video must be saved.
  • Setting the interval at which the overlay starts will be large.

Current solution

ffmpeg -i input.mov -i overlay.mov -filter_complex "[0:0][1:0]overlay[out]" -shortest -map [out] -map 0:1 -pix_fmt yuv420p -c:a copy -c:v libx264 -crf 18  output.mov

This almost works, however:

  • , (input.mov overlay.mov) .
  • , 0:00.
+4
1

ffmpeg,

ffmpeg -i input.mov -i overlay.mov \
-filter_complex "[1:v]setpts=PTS-10/TB[a]; \
                 [0:v][a]overlay=enable=gte(t\,5):shortest=1[out]" \
-map [out] -map 0:a \
-c:v libx264 -crf 18 -pix_fmt yuv420p \
-c:a copy \
output.mov

5 , 00:15.

setpts=PTS-10/TB setpts=PTS+(overlay_delay-video_trim_in)/TB

overlay=enable=gte(t\,5) overlay=enable=gte(t\,overlay_delay)

+2

Source: https://habr.com/ru/post/1627784/


All Articles