I don’t cut videos too often, but sometime I still have to do some video cutting works like simply merging my recorded gaming videos.

As a developer, if there is something that can be done from commandline, I wouldn’t bother to find some other GUI app.

FFmpeg is obviously the powerful tool to fulfill my requirements.

Cut Video

1
2
3
4
# Cut by timestamp
ffmpeg -ss 00:00:30.0 -i input.wmv -t 00:00:10.0 -c copy output.wmv
# Cut by frame number
ffmpeg -ss 30 -i input.wmv -t 10 -c copy output.wmv
  • Arguments’ order is important, fail to keep them in the following order -ss <START_TIME> -i <INPUT_FILE> -t <END_TIME> [other] will result in getting an corrupted video. Official document on this matter.

See Seeking for more details.

Merge Videos

1
2
3
4
5
6
# Create File List
echo file file1.mp4 > mylist.txt
echo file file2.mp4 >> mylist.txt
echo file file3.mp4 >> mylist.txt
# Concatenate Files
ffmpeg -f concat -i mylist.txt -c copy output.mp4

See Concatenate for more info.