FFmpeg command generator
Pick a job, set the options, copy a working ffmpeg command — compress a video (or fit it under a size like 10 MB for Discord), extract MP3, make a GIF, trim, add a subtitle track, normalise loudness. Each flag is explained below the command.
·
Unofficial — FFmpeg is a trademark of Fabrice Bellard; FFmpeg is made by the FFmpeg project (LGPL/GPL). Prefer buttons to a terminal? GUI Hub’s Video Toolkit runs these same commands from a form, offline, and shows the command it ran.
Common FFmpeg commands
Compress / convert to MP4
Make a video much smaller (or turn any video into a widely playable MP4). Lower quality and smaller size = smaller file.
ffmpeg -y -i input.mp4 -vcodec libx264 -crf 28 -preset medium -pix_fmt yuv420p -acodec aac -ab 128k -movflags +faststart output.mp4
Compress to a file size
Make a video fit under a size limit (e.g. 10 MB for Discord, 25 MB for email). Works out the bitrate from the video's length and lowers the resolution only when it has to. Lands a little under the target; very long videos may need trimming first.
ffmpeg -y -i input.mp4 -vcodec libx264 -b 1130k -maxrate 1130k -bufsize 2260k -preset medium -pix_fmt yuv420p -vf 'scale=-2:'\''min(720,ih)'\''' -acodec aac -ab 96k -movflags +faststart output.mp4
Extract audio (MP3)
Save just the sound of a video as an MP3 — for music, lectures or podcasts.
ffmpeg -y -i input.mp4 -vn -acodec libmp3lame -ab 192k output.mp3
Convert audio
Convert any audio (or the sound of a video) to MP3, M4A, WAV or FLAC — and optionally even out the volume so quiet recordings are easy to hear.
ffmpeg -y -i input.mp4 -vn -acodec libmp3lame -ab 192k output.mp3
Make a GIF
Turn a short part of a video into a good-looking animated GIF.
ffmpeg -y -ss 0 -t 5 -i input.mp4 -vf 'fps=12,scale=480:-1:flags=lanczos,split[a][b];[a]palettegen[p];[b][p]paletteuse' -loop 0 output.gif
Trim
Cut out a part of a video instantly, without re-encoding (no quality loss). Cuts snap to the nearest keyframe.
ffmpeg -y -ss 00:00:00 -to 00:00:30 -i input.mp4 -vcodec copy -acodec copy output.mp4
Add subtitles to a video
Puts an .srt subtitle file into a video as a subtitle track (viewers can switch it on/off). The video is not re-encoded, so it’s fast and keeps full quality.
ffmpeg -y -i input.mp4 -i subtitles.srt -map 0:v -map '0:a?' -map 1:0 -vcodec copy -acodec copy -scodec mov_text -movflags +faststart output.mp4
Fix volume (normalize loudness)
Makes quiet or uneven recordings sound loud and even — like a podcast or YouTube video. Works on audio and video; the picture is not touched.
ffmpeg -y -i input.mp3 -af loudnorm=I=-16:TP=-1.5:LRA=11 -vn -ar 48000 output.mp3
The file-size example assumes a 1-minute video and a 10 MB target.
Questions
How does “compress to a file size” work?
Size ≈ bitrate × length. Enter the video’s length and the size you need; the page budgets 92% of it (container overhead), keeps 96 kbit/s for sound, caps the bitrate with -maxrate so the target holds, and lowers the resolution only when the bitrate gets too low for it.
Are these the right options for my version?
They are the commands GUI Hub itself runs, and every option is checked against the real FFmpeg 6.1.1 help output on Windows, macOS and Linux in our automated tests.
Do I need to install anything?
Only FFmpeg itself (ffmpeg.org, or winget install ffmpeg / brew install ffmpeg / your Linux package manager). This page just writes the command; nothing is uploaded. If you’d rather not use a terminal, the GUI Hub desktop app runs the same commands from a form, offline, and its MCP server lets Claude or Cursor run them for you.
Windows: why do the quotes look different?
cmd and PowerShell don’t understand single quotes, so the Windows version wraps arguments with spaces in double quotes. Pick your system above the command.