Skip to content

Instantly share code, notes, and snippets.

@Mr-Guilherme
Created September 7, 2021 16:01
Show Gist options
  • Select an option

  • Save Mr-Guilherme/81d3a52027b8e4498a9f02b2a0f8a423 to your computer and use it in GitHub Desktop.

Select an option

Save Mr-Guilherme/81d3a52027b8e4498a9f02b2a0f8a423 to your computer and use it in GitHub Desktop.
ffmpeg common commands to cut video.

Cut video with re-encoding

  1. Flag -to HH:MM:SS.MILLISECONDS is for determining the end time of the video to be cut.
  2. Flag -i is input video as path.
  3. The last path is output of video.
foo@bar: ffmpeg -to 00:15:00 -i ./media/file.mp4 ./media/newFile.mp4 
  1. Flag -ss is for determining the start time of the video to be cut.
  2. It is algo possible convert the video format.
foo@bar: ffmpeg -ss 00:15:00 -i ./media/file.mkv ./media/newFile.mp4

Cut video without re-encoding

The arguments -c:v copy and -c:a copy is for duplicate video and audio track. Increases speed a lot, but can be inaccurate.

foo@bar: ffmpeg -ss 00:15:00 -to 00:30:00 -i ./media/file.mp4 -c:v copy -c:a copy ./media/newFile.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment