ffmpeg
CLIComplete, cross-platform solution for recording, converting, and streaming audio/video.
2 views
Installation
Homebrew
brew install ffmpegLinks
License
LGPL-2.1 / GPL-2.0AI Agent Notes
Convert, compress, trim, and process audio and video files
When to use
Any audio/video format conversion or media processing task
Examples
ffmpeg -i input.mp4 output.gifffmpeg -i video.mp4 -vn audio.mp3
Proven Recipes
Convert MP4 to GIF🟢 92% success
ffmpeg -i input.mp4 -vf 'fps=10,scale=640:-1' -loop 0 output.gif⚠ Common failures (2)
- GIF is huge file size → Lower fps (fps=10) and scale (scale=480:-1)
- GIF looks washed out → Add palettegen: ffmpeg -i input.mp4 -vf palettegen palette.png && ffmpeg -i input.mp4 -i palette.png -filter_complex paletteuse output.gif
Extract audio from video🟢 97% success
ffmpeg -i video.mp4 -vn -acodec mp3 -ab 192k audio.mp3Trim video to a time range🟢 96% success
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:30 -c copy output.mp4⚠ Common failures (1)
- Trim not accurate → Put -ss before -i for fast seek: ffmpeg -ss 00:01:00 -i input.mp4 -to 00:01:30 -c copy output.mp4
Convert video to a different format🟢 94% success
ffmpeg -i input.avi -c:v libx264 -crf 23 -c:a aac output.mp4Compress video for web🟢 93% success
ffmpeg -i input.mp4 -vcodec libx264 -crf 28 -preset fast output.mp4⚠ Common failures (1)
- Output too large → Increase crf value (28-32 for smaller size)