Generate FFmpeg commands without memorizing every flag.
Use the FFmpeg command generator below, then copy your command and run it locally. Your files stay on your computer.
Basic Settings
Generated FFmpeg Command
A ready-to-run example is generated below. Adjust any setting or copy it now.
Three FFmpeg command examples
Replace the input filenames with your own. These commands require FFmpeg installed on your computer.
Compress an MP4
A practical starting point for an H.264 MP4. The result may be larger if the source is already heavily compressed.
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k -movflags +faststart compressed.mp4- -i input.mp4
- Read the source video.
- -c:v libx264
- Encode H.264 video.
- -crf 23
- Set video quality; lower values preserve more detail and usually use more space.
- -preset medium
- Balance encoding time and compression efficiency.
- -c:a aac -b:a 128k
- Encode audio as AAC at 128 kbit/s.
- -movflags +faststart
- Move MP4 playback metadata to the beginning for web playback.
- compressed.mp4
- Write to a new output file.
Turn five seconds of video into a GIF
Create a small preview with a palette generated from the selected clip.
ffmpeg -ss 0 -t 5 -i input.mp4 -filter_complex "fps=12,scale=480:-1:flags=lanczos,split[a][b];[a]palettegen[p];[b][p]paletteuse" -an output.gif- -ss 0 -t 5
- Read five seconds starting at the beginning; change -ss to choose another start time.
- -i input.mp4
- Read the source video.
- -filter_complex
- Apply the connected filter graph inside the quotes.
- fps=12
- Use 12 frames per second to limit GIF size.
- scale=480:-1:flags=lanczos
- Resize to 480 pixels wide and preserve the aspect ratio.
- split, palettegen, paletteuse
- Send two copies of the frames through the labeled branches: build a palette, then apply it.
- -an output.gif
- Omit audio and write the GIF.
Extract a video’s audio as MP3
Save the first audio track as an MP3 for a player or editor that needs that format.
ffmpeg -i input.mp4 -map 0:a:0 -vn -c:a libmp3lame -b:a 192k audio.mp3- -i input.mp4
- Read the source video.
- -map 0:a:0
- Select the first audio stream from the first input.
- -vn
- Exclude video from the output.
- -c:a libmp3lame
- Re-encode the selected audio as MP3.
- -b:a 192k
- Use a constant 192 kbit/s audio bitrate.
- audio.mp3
- Write a separate MP3 file.
Browse by workflow
Convert
Change formats and containers while controlling quality.
Compress
Reduce file size with practical codec, CRF, and preset choices.
Edit
Cut, merge, crop, resize, and adjust video files from the command line.
Watermark
Add logos and watermarks to video with overlay commands.
Subtitles
Burn subtitles into video or attach selectable subtitle tracks.
Audio
Extract, convert, or remove audio tracks from media files.
Debug
Understand FFmpeg errors and find practical fixes.
Debug FFmpeg errors
Paste an FFmpeg error and find a fix
The FFmpeg Error Explainer matches common errors like unknown encoders, moov atom issues, codec copy filter conflicts, and missing files.
Command recipes
Copy common FFmpeg commands and open a tool when you need to customize them.
Articles
More articles →How to Add Text Watermark to Video with FFmpeg
→Add a text watermark to video with FFmpeg drawtext. Includes corner positioning, opacity, borders, fonts, and common troubleshooting tips.
How to Add Subtitles to MP4 Using FFmpeg
→Burn subtitles into video with FFmpeg. Escape Windows subtitle paths, preserve ASS styling, or add selectable MP4 subtitles with mov_text.
How to Compress 4K Video Size Without Losing Too Much Quality
→Compress 4K video with FFmpeg using H.264, H.265, CRF, presets, and optional downscaling. Includes practical commands for smaller uploads and web delivery.
How to Convert Video to MP4 Without Losing Quality
→Convert AVI to MP4 with FFmpeg using CRF 18 and preset slow. Compare measured sizes and times for 10-second, 1-minute and 10-minute synthetic clips.
How to Add an Image Watermark (Logo) to a Video with FFmpeg
→Add a logo or image watermark to video with FFmpeg overlay. Includes bottom-right positioning, scaling, opacity notes, quality settings, and common fixes.
How to Compress or Reduce Video File Size with FFmpeg
→Reduce video file size with FFmpeg using CRF, presets, H.264, H.265, and audio settings. Includes copyable commands, quality guidance, and common mistakes.
Supported scenarios
Open a focused command generator for one of these six common tasks.
Compress video
Choose a codec and quality setting to reduce file size.
Merge videos
Join matching clips or re-encode mixed sources.
Extract audio
Save a video’s audio as MP3, AAC, WAV, or FLAC.
Convert video
Change the container or encode a compatible format.
Crop video
Remove unwanted edges or change the frame composition.
Create a GIF
Turn a short video clip into a palette-optimized GIF.