trimming videos using ffmpeg

ffmpeg is an alternative to GUI video editors, it's very powerful once you learn how to use it. The reason I started using it was because I had a specific use-case: I wanted to trim a video clip while removing audio and keeping quality. I was doing this on my laptop which runs linux where GUIs were too slow.

In ffmpeg, to achieve what I wanted, all I had to do was run this command:

ffmpeg -i INPUT_FILE -an -sn -c:v VIDEO_CODEC -ss FROM -to TO OUTPUT_FILE

Let's go through the command and break down what each argument does.

  1. -i specifies the input file, this is the video that I wanted to trim
  2. -an removes audio because I didn't need it
  3. -sn removes subtitles
  4. -c:v specifies the video codec to use, I wanted to use a lossless one to make the quality wasn't changed

to get a list of video codecs use ffmpeg -encoders

  1. -ss specifies the trim start time
  2. -to specifies the trim end time
  3. OUTPUT_FILE is the path to save the output to

I picked most of this up from reading ffmpeg's manual page which is full of really good info