Title : How to remove a part of a video using ffmpeg
Author: Solène
Date : 02 October 2019
Tags : ffmpeg
If you want to remove parts of a video, you have to cut it into pieces and then
merge the pieces, so you can avoid parts you don't want.
The command is not obvious at all (like in all ffmpeg uses), I found some parts
on differents areas of the Internet.
Split in parts, we want to keep from 00:00:00 to 00:30:00 and 00:35:00 to 00:45:00
ffmpeg -i source_file.mp4 -ss 00:00:00 -t 00:30:00 -acodec copy -vcodec copy part1.mp4
ffmpeg -i source_file.mp4 -ss 00:35:00 -t 00:10:00 -acodec copy -vcodec copy part2.mp4
The -ss parameter tells ffmpeg where to start the video and -t parameter tells
it about the duration.
Then, merge the files into one file:
printf "file %s\n" part1.mp4 part2.mp4 > file_list.txt
ffmpeg -f concat -i file_list.txt -c copy result.mp4
instead of printf you can write into file_list.txt the list of files like this:
file /path/to/test1.mp4
file /path/to/test2.mp4