ffmpeg
CLIComplete, cross-platform solution for recording, converting, and streaming audio/video.
Convert, compress, trim, and process audio and video files
Recipes
Curated from documentation and usage. Percentages are estimates, not measurements.
Convert MP4 to GIF
ffmpeg -i input.mp4 -vf 'fps=10,scale=640:-1' -loop 0 output.gifCommon failures (2)
- GIF is huge file sizeLower fps (fps=10) and scale (scale=480:-1)
- GIF looks washed outAdd 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
ffmpeg -i video.mp4 -vn -acodec mp3 -ab 192k audio.mp3Trim video to a time range
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:30 -c copy output.mp4Common failures (1)
- Trim not accuratePut -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
ffmpeg -i input.avi -c:v libx264 -crf 23 -c:a aac output.mp4Compress video for web
ffmpeg -i input.mp4 -vcodec libx264 -crf 28 -preset fast output.mp4Common failures (1)
- Output too largeIncrease crf value (28-32 for smaller size)
Install
Homebrew
brew install ffmpegAgent notes
- When to use
- Any audio/video format conversion or media processing task
- Quick examples
ffmpeg -i input.mp4 output.gifffmpeg -i video.mp4 -vn audio.mp3
Use from an agent
curl -s https://clihub.com/api/tools/ffmpeg | jq '.agentHints.provenRecipes[] | {task, command, verified}'Or call get_tool with slug ffmpeg on the MCP server at https://clihub.com/mcp.