ffmpeg cuts multiple parts of a video, and then merges all the cuts into one video

If you want to use ffmpeg to crop a video into multiple parts and then merge all the crops into one video,

Then you can execute:

ffmpeg -i input -filter_complex "[0:v:0]select='between(t,10.5,12.0)+between(t,12.5,15.0)+between(t,17.5,20.5)',setpts=N/FRAME_RATE/TB[outv]; [0:a:0]aselect='between(t,10.5,12.0)+between(t,12.5,15.0)+between(t,17.5,20.5)',asetpts=N/SR/TB[outa]" -map "[outv]" -map "[outa]" output.mp4

or execute:

ffmpeg -i input -filter_complex "[0:v:0]select='between(t,10.5,12.0)+between(t,12.5,15.0)+between(t,17.5,20.5)',setpts=N/FRAME_RATE/TB;[0:a:0]aselect='between(t,10.5,12.0)+between(t,12.5,15.0)+between(t,17.5,20.5)',asetpts=N/SR/TB" output.mp4

This instruction means to crop the three time periods of the video from 10.5s to 12 seconds, from 12.5s to 15s, and from 17.5s to 20.5s, and then merge these three time periods into one output.mp4 file.

Note: input is the path where the video needs to be cropped

Guess you like

Origin blog.csdn.net/Smallwhitestrive/article/details/128146686