Edit Videos with FFmpeg FreeBSD

It’s not something that I have the need or desire to do often, but I had a video from my phone that I wanted to upload someplace, but it was just too large. The handful of times that I had to do this, I hunted down a GUI program and had to figure out how to use them. To me, they’re just not very intuitive for what I needed to do. Scale the resolution down and cut the beginning and the end sections off.

Recently, I had read of using FFmpeg to resize images, so I figured just by the name that it would do videos too. I looked at the man file and also did some searching on the interwebs. I found out how to do exactly what I needed to do in two commands

First, I needed to resize it. First, to resize it, I needed to run this. (The original video’s resolution was 2160 x 3840.) I wanted to scale it down to half the size, so that means I wanted it to be 1080x1920. I am sure there’s a better way to do this, but this I what I found that worked after my typo ridden attempts.

ffmpeg -i 20221210_120830.mp4 -vf scale=1080:1920 -preset slow -crf 18 output.mp4

Now that I had it resized, I needed to remove some extra parts in both the beginning and end of the video. This was much easier to get right. I wanted 45 seconds of the video to be kept after chopping off the first 25 seconds.

ffmpeg -i output.mp4 -ss 25 -t 45 -acodec copy -vcodec copy TheOutput.mp4

I did one last thing to reduce the size of the video even more. I reduced the frame rate from 60 fps to 30 since that’s good enough for where I wanted to share the video.

ffmpeg -i TheOutput.mp4 -filter:v fps=fps=30 output.mp4

Here are some other FFmpeg tips:

Get a video’s information

ffmpeg -i Video.mp4

back.