[FFmpeg-user] replace several lines by one using the filter_complex

Leonardo lsbplsb at yahoo.com
Thu Jul 9 22:31:33 EEST 2020


Hello,

I have a video that I need to extract two parts of it and merge together those parts. I can accomplish this using the TRIM/ATRIM filter together with the concat demuxer:


$ ffmpeg -i video.mp4 -vf "trim=start=7:end=1173,setpts=PTS-STARTPTS" -af "atrim=start=7:end=1173,asetpts=PTS-STARTPTS" part1.mp4


$ ffmpeg -i video.mp4 -vf "trim=start=1260:end=1430,setpts=PTS-STARTPTS" -af "atrim=start=1260:end=1430,asetpts=PTS-STARTPTS" part2.mp4


After this I create a file input.txt (duration found with ffprobe):
file 'part1.mp4'
duration 1166.02file 'part2.mp4'duration 170.02


And finish with 


$ ffmpeg -f concat -i input.txt -c copy video_final.mp4


This sequence of steps work as expected but I would like to know if it is possible to use the filter_complex with only "one line command" to achieve same result ?

Kind regards,
Leonardo


More information about the ffmpeg-user mailing list