FFmpeg tips: Quickly cut video clips or extract audio

FFmpeg tips: Quickly cut video clips or extract audio

You can make quick work of trimming videos or capturing just the audio with FFmpeg and a Chromebook.

(This is another post on using a Chromebook as a video tool for journalists. Previously, we have shown how to Create video slideshows with ImageMagick and FFmpeg in minutes and how to use FFmpeg with Google Earth. And we have shown how to get a video from the internet with youtube-dl. )

We’re using the terminal window of Linux on the Chromebook. There is a Windows version of FFmpeg and you could install Linux on your Windows 10 computer.

Often, you just need a small segment, or clip, from a video. FFmpeg makes this super fast with this command:

ffmpeg -i source-video-file-name -ss 1:27 -to 3:02 
-c:v copy -c:a copy output-file-name

This command begins copying at the 1:27 minute mark and stop at the 3:02 minute mark. If you want to copy to the end, you can omit the “-to endtime.”

If you want get just audio from a video, you can use this command:

ffmpeg -i input-file-name -f mp3 -ab 192000 -vn output-audio.mp3

Again, this is very fast. I liked to get the audio of Zoom meeting videos and then upload just the audio file into a speech-to-text tool like Otter.ai. Just uploading the audio is faster than uploading the whole video file to Otter.

If you need to remove the audio from a video file, here’s your command:

ffmpeg -i input-file-name -c copy -an output-file-name

If you want info on the video and audio in the file, use this command:

ffprobe -v error -show_format -show_streams input-file-name

It can get a lot more complicated real quick, but the above are typical use cases. The FFmpeg sub-Reddit is a good place to find help.