1

I was able to find this thread on cutting a specific portion out of a file. It's not very useful since I'm looking to do the exact opposite which is to remove the selected portion of the video.

This user's solution for extracting a part without re-encoding works pretty well. Can I do something similar to remove a selection portion instead?

I prefer not having to re-encode, but I'm fine either way so any solution would do.

2
  • 1
    Potential solution: superuser.com/questions/1385882/…
    – Mokubai
    Commented Feb 20, 2022 at 13:19
  • You may use concat demuxer with inpoint and outpoint as described in the following post. It is done without re-encoding. Without re-encoding has some limitations (it cuts only in key frames, and it's not always working).
    – Rotem
    Commented Feb 20, 2022 at 17:09

1 Answer 1

1

Extract the parts you want by using the as codec the "Copy" option -c:v copy -c:a copy

Let's say you have a 6 minutes video and you don't want the parts from 2-3 min and from 4-5 min:

ffmpeg -ss 00:00:00 -to 00:02:00 -i input.mp4 -c:v copy -c:a copy input_part1.mp4
ffmpeg -ss 00:03:00 -to 00:04:00 -i input.mp4 -c:v copy -c:a copy input_part2.mp4
ffmpeg -ss 00:05:00 -to 00:06:00 -i input.mp4 -c:v copy -c:a copy input_part3.mp4

Create a text file for the files you extracted (filelist.txt)

file 'input_part1.mp4'
file 'input_part2.mp4'
file 'input_part3.mp4'

Then join them together with something like this

ffmpeg -safe 0 -f concat -i filelist.txt -c copy output.mp4

output.mp4 should not have the parts you don't want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .