FFmpeg
ffmpeg is a powerful tool for video compression.
What is FFmpeg?
- Official site: https://ffmpeg.org/
- FFmpeg is an open-source video compression tool
- FFmpeg is a command-line video conversion tool

Test Environment
- PC: MacBook Pro (16-inch, 2019)
- OS: Sonoma 14.7.2
- Terminal: zsh
Installation
Open terminal and install ffmpeg using package manager Homebrew
brew install ffmpegVersion check
ffmpeg -versionUsage
Navigate to the folder containing the video you want to compress in terminal and enter commands.
ffmpeg -i [input file] [output options] [output file]Neil’s encoding introduced in FabAcademy is shown below. These commands are used for video/audio compression, trimming, compositing, and quality settings for efficient web video delivery.
Neil’s Encoding
HTML5 MP4 ffmpeg encoding
codecs
- H.264: good compression, widely supported
- H.265: better compression, less widely supported
~megabytes/minute compression for Web
variable bit rate 1080p MP3:
ffmpeg -i input_video -vcodec libx264 -crf 25 -preset medium -vf scale=-2:1080 -acodec libmp3lame -q:a 4 -ar 48000 -ac 2 output_video.mp4fixed bit rate 1080p MP2:
ffmpeg -i input_video -vcodec libx264 -b:v 1000k -vf scale=-2:1080 -acodec mp2 -b:a 256k -ar 48000 -ac 2 output_video.mp4no audio:
ffmpeg -i input_video -vcodec libx264 -b:v 1000k -vf scale=-2:1080 -an output_video.mp4crop size (width:height:xoffset:yoffset):
ffmpeg -i input_video -vf crop=1500:800:200:100 -vcodec libx264 -b:v 1000k -an output_video.mp4trim time (-ss start time, -t duration):
ffmpeg -i input_video -vcodec libx264 -b:v 1000k -an -ss 00:00:10 -t 00:00:10 output_video.mp4mix audio and video:
ffmpeg -i input_video -vcodec libx264 -b:v 1000k -vf crop=1120:876:0:100 -i input_audio -acodec mp2 -b:a 256k -ar 48000 -ac 2 -ss 00:00:20 -t 00:00:20 output_video.mp4crop, pan, composite:
ffmpeg -i input_video_1 -i input_video_2 -filter_complex '[1:v]crop=175:95:930:860[cropout];[cropout]scale=350:190[scaleout];[0:v][scaleout]overlay=10:10[outv]' -map '[outv]' -vcodec libx264 -b:v 1000k -map 0:a -acodec mp2 -b:a 256k -ac 2 -t 00:00:05 output_video.mp4numbered images to video:
ffmpeg -r 30 -i %04d.jpg -vcodec libx264 -b:v 1000k -vf scale=-2:1080 -an output_video.mp4Contact
If you have any questions about using FFmpeg, please feel free to ask our staff.
