ffmpeg -i long.mp4 -i short.mp4 -filter_complex "[1:v] trim=0:58, setpts=PTS-STARTPTS [cut]; [0:v][cut] overlay=enable='between(t,0,58)' [out]" -map "[out]" out.mp4 # replace the first 58 seconds of the video track of "long.mp4" with the video track of "short.mp4"