How can I cut a video into multiple parts and then join them together to make a new video with ffmpeg?
You can use the concat demuxer.
#1 Create a text file
file video.mp4
inpoint 34.5
outpoint 55.1
file video.mp4
inpoint 111.0
outpoint 155.3
file video.mp4
inpoint 278
outpoint 316.4
The inpoint/outpoint directives specify the trim in and out points in seconds for the file listed above them.
#2a Create the joint file
ffmpeg -f concat -i list.txt combined.mp4
#2b Do the overlay together
ffmpeg -f concat -i list.txt -i background.mp4 -filter_complex "[0:v]scale=400:400[v1];[1:v][v1]overlay=0:0:shortest=1" -shortest -preset superfast "output.mp4"
External Audio stream with concat
ffmpeg -i 12m.mp4 -f concat -i list.txt -vf setpts=(PTS-STARTPTS)/1.1 -af atempo=1.1 -map 1:v -map 0:a -shortest new.mp4