glunty

ffmpeg Cheat Sheet

A searchable reference of common ffmpeg commands and what each one does.

Common ffmpeg commands with a plain-English description of what each one does
Command What it does
ffmpeg -i input.mp4 output.mkv Convert a file to a new format; the output extension sets the container and default codecs.
ffmpeg -i input.mov -c copy output.mp4 Remux into an MP4 by copying streams, with no re-encoding, so it is fast and lossless.
ffmpeg -i input.avi output.mp4 Change the container from AVI to MP4, re-encoding with the default codecs.
ffmpeg -i in.mp4 -c:v libx264 -c:a aac out.mp4 Transcode to H.264 video and AAC audio, the most widely compatible MP4 combination.
ffmpeg -i in.mkv -c copy out.mp4 Rewrap an MKV as MP4 by copying streams (only works if the codecs are allowed in MP4).
ffmpeg -i in.webm -c:v libx264 -c:a aac out.mp4 Convert a WebM file into a broadly compatible H.264 and AAC MP4.
ffmpeg -i in.mp4 -c:v libx265 -crf 28 out.mp4 Re-encode with HEVC (H.265) for a smaller file at similar visual quality.
ffmpeg -i in.mp4 -movflags +faststart out.mp4 Move the MP4 index to the front so playback can start before the file finishes downloading.
ffmpeg -formats List every container format this build can read or write.
ffmpeg -codecs List every audio and video codec available in this build.
ffmpeg -ss 00:00:10 -i in.mp4 -t 30 out.mp4 Skip to the 10 second mark and keep the next 30 seconds; -t sets the duration.
ffmpeg -i in.mp4 -ss 00:00:10 -to 00:00:40 out.mp4 Keep the segment between the 10 and 40 second marks; -to is an absolute end time.
ffmpeg -ss 00:01:00 -i in.mp4 -t 20 out.mp4 Start at the 1 minute mark and keep 20 seconds.
ffmpeg -ss 00:00:10 -i in.mp4 -t 30 -c copy out.mp4 Add -c copy for a lossless trim with no re-encoding; cut points snap to the nearest keyframe.
ffmpeg -sseof -30 -i in.mp4 -c copy out.mp4 Keep only the last 30 seconds; -sseof seeks backward from the end of the file.
ffmpeg -i in.mp4 -ss 90 -t 15 out.mp4 Use plain seconds instead of HH:MM:SS: start at 90 seconds and keep 15 seconds.
ffmpeg -i in.mp4 -vf scale=1280:720 out.mp4 Resize the video to exactly 1280 by 720 pixels.
ffmpeg -i in.mp4 -vf scale=-2:720 out.mp4 Scale to 720 pixels tall and let ffmpeg pick a width that keeps the aspect ratio (-2 rounds to an even number).
ffmpeg -i in.mp4 -r 30 out.mp4 Force the output to 30 frames per second.
ffmpeg -i in.mp4 -c:v libx264 -crf 23 out.mp4 Set quality with the Constant Rate Factor; lower is better and 23 is the libx264 default.
ffmpeg -i in.mp4 -c:v libx264 -preset slow out.mp4 Use a slower preset for better compression at the same quality (encoding takes longer).
ffmpeg -i in.mp4 -b:v 2M out.mp4 Target an average video bitrate of 2 megabits per second.
ffmpeg -i in.mp4 -pix_fmt yuv420p out.mp4 Store pixels as 8-bit 4:2:0 for broad player and browser compatibility.
ffmpeg -i in.mp4 -vf transpose=1 out.mp4 Rotate the video 90 degrees clockwise (use transpose=2 for counter-clockwise).
ffmpeg -i in.mp4 -vf "crop=640:480:0:0" out.mp4 Crop a 640 by 480 region starting at the top-left corner (crop=w:h:x:y).
ffmpeg -i in.mp4 -vf "transpose=1,transpose=1" out.mp4 Rotate the video 180 degrees by applying two 90-degree turns.
ffmpeg -i in.mp4 -an out.mp4 Remove the audio and keep only the video (-an means no audio).
ffmpeg -i in.mp4 -vn -c:a copy out.m4a Drop the video and copy the audio stream out unchanged (-vn means no video).
ffmpeg -i in.mp4 -q:a 2 out.mp3 Extract the audio to a high-quality variable-bitrate MP3 (-q:a 2 is around 190 kbps).
ffmpeg -i in.mp4 -c:a aac -b:a 192k out.m4a Re-encode the audio to AAC at a 192 kbps bitrate.
ffmpeg -i in.wav -ar 44100 out.wav Resample the audio to a 44100 Hz sample rate.
ffmpeg -i in.wav -ac 2 out.wav Set the audio to 2 channels (stereo), downmixing if needed.
ffmpeg -i video.mp4 -i audio.m4a -map 0:v -map 1:a -c copy out.mp4 Replace the audio: take video from the first input and audio from the second.
ffmpeg -i in.mp3 -af "volume=1.5" out.mp3 Raise the volume by 50 percent (use volume=0.5 to halve it).
ffmpeg -i in.flac out.mp3 Convert a lossless FLAC file to an MP3.
ffmpeg -ss 5 -i in.mp4 -vframes 1 out.jpg Grab a single frame at the 5 second mark and save it as a JPEG.
ffmpeg -i in.mp4 -vf fps=1 out%03d.png Export one frame per second as numbered PNG files like out001.png and out002.png.
ffmpeg -framerate 24 -i img%03d.png out.mp4 Build a video from a numbered image sequence at 24 frames per second.
ffmpeg -i in.mp4 -vf palettegen palette.png Generate an optimized 256-color palette for a better-looking GIF.
ffmpeg -i in.mp4 -i palette.png -lavfi paletteuse out.gif Turn the video into a GIF using the generated palette for cleaner colors.
ffmpeg -i in.mp4 -vf "fps=15,scale=480:-1" out.gif Make a smaller GIF by dropping to 15 fps and scaling the width to 480 pixels.
ffmpeg -i in.gif out.mp4 Convert a GIF into an MP4, which is usually a much smaller file.
ffmpeg -f concat -safe 0 -i list.txt -c copy out.mp4 Concatenate the clips listed in list.txt into one file without re-encoding (concat demuxer).
ffmpeg -i main.mp4 -i logo.png -filter_complex overlay=10:10 out.mp4 Overlay the second input, such as a logo, at position x=10, y=10 over the video.
ffmpeg -y -i in.mp4 out.mp4 Overwrite the output file without asking; use -n instead to never overwrite.
ffprobe -i in.mp4 Inspect a file and print its format, duration, and stream details.
ffmpeg -hide_banner -i in.mp4 out.mp4 Hide the build and library banner to keep the console output short.
ffmpeg -hwaccel cuda -i in.mp4 out.mp4 Use GPU hardware acceleration where available (values vary: cuda, qsv, videotoolbox).
ffmpeg -i in.mkv -map 0 -c copy out.mkv Keep every stream from the input; -map 0 selects all video, audio, and subtitles.
ffmpeg -i in.mkv -map 0:a:0 -c copy out.m4a Select just the first audio stream by its index and copy it out.

Runs entirely in your browser. Nothing you type is sent anywhere; open DevTools and watch the Network tab to verify zero requests.

What this tool does

This is a searchable quick reference for the ffmpeg commands you reach for most, from converting between formats to trimming clips, resizing and re-encoding video, pulling out or replacing audio, grabbing frames, and building GIFs. Each row pairs the exact command with a plain-English note on what it does. Type in the filter box to search across both columns, or tap a category button to focus on one kind of task. The whole list is built into the page, so it works offline and sends nothing anywhere.

How to use it

Start typing in the Filter box. Entering scale jumps to the resize commands; entering crf surfaces the quality options; entering gif shows the palette-based GIF recipe. The category buttons (Convert, Trim, Video, Audio, Images and GIF, Misc) narrow the table to one family and combine with the text filter, so you can pick Audio and type aac to zero in on the encoder flags. Clear the box to see the full sheet again. Placeholders like in.mp4 and out.mp4 stand in for your own file names.

Common use cases

  • Recalling the exact flags for a task you do rarely, like -vf scale=-2:720 or palettegen.
  • Copying a safe command into your terminal instead of guessing at the syntax.
  • Converting a video to a widely compatible -c:v libx264 -c:a aac MP4.
  • Trimming a clip losslessly with -ss, -t, and -c copy.
  • Extracting a single frame or a whole numbered image sequence from a video.

Common pitfalls

  • Copying streams into the wrong container. -c copy only works when the source codecs are allowed in the target container. Rewrapping an MKV with unusual codecs into MP4 can fail, so re-encode when copy reports an error.
  • Seeking after -i by mistake. Putting -ss after -i decodes every frame from the start, which is slow on long files. Put -ss before -i for a fast keyframe seek when you can.
  • Skipping the palette step for GIFs. A direct video-to-GIF conversion looks banded because GIF holds only 256 colors. Run palettegen then paletteuse for clean results, and lower the frame rate and width.
  • Forgetting pixel format for compatibility. Some players and browsers reject video that is not yuv420p. Add -pix_fmt yuv420p when a file plays in ffmpeg but shows a black screen elsewhere.

Frequently asked questions

How do I convert a video without re-encoding?
Use stream copy with -c copy, for example ffmpeg -i input.mov -c copy output.mp4. This remuxes the existing audio and video streams into a new container without decoding or re-encoding them, so it is nearly instant and completely lossless. It only works when the source codecs are allowed in the target container; if they are not, ffmpeg reports an error and you have to re-encode instead.
What does -crf control?
CRF stands for Constant Rate Factor and it sets the quality target for encoders like libx264 and libx265. A lower number means higher quality and a larger file, while a higher number means more compression and a smaller file. For libx264 the scale runs from 0 to 51, the default is 23, and most people pick something between 18 and 28. Unlike a fixed bitrate, CRF lets the encoder spend more bits on complex scenes and fewer on simple ones.
How do I extract the audio from a video?
To pull the audio out losslessly, drop the video stream and copy the audio: ffmpeg -i input.mp4 -vn -c:a copy output.m4a. If you want an MP3 instead, let ffmpeg re-encode with ffmpeg -i input.mp4 -q:a 2 output.mp3, where -q:a 2 selects a high-quality variable bitrate. Use -c:a copy only when the container you are writing to supports the original audio codec.
How do I turn a video into a GIF?
For a clean GIF, generate a color palette first and then apply it. Run ffmpeg -i input.mp4 -vf palettegen palette.png, then ffmpeg -i input.mp4 -i palette.png -lavfi paletteuse output.gif. GIF supports only 256 colors, so the palette step avoids the banding you get from a naive conversion. Lower the frame rate and scale the width down to keep the file size reasonable.
Why should I put -ss before -i?
Placing -ss before -i makes ffmpeg seek by jumping to the nearest keyframe before it starts decoding, which is very fast even on long files. Placing -ss after -i decodes every frame from the start until it reaches your timestamp, which is accurate to the exact frame but slow. For quick lossless cuts with -c copy, put -ss before -i; when you need frame-accurate trimming, seek after -i or re-encode.
Does this cheat sheet upload my files or send my searches anywhere?
No. This page never touches your files at all; it is only a reference list of commands that you run yourself in a terminal. The command list is baked into the page and every search and filter happens locally in your browser with JavaScript, so nothing you type leaves your device. Open your browser DevTools and watch the Network tab while you search to confirm there are zero requests.

Embed this tool

Free for any use; attribution appreciated. Paste this on your site:

The embed runs the same tool that lives at this URL. No tracking; no ads inside the embed. Resize height as needed for your layout.

Cite this tool

For academic, journalistic, or technical references. Pick a format:

Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.

Embedded tool from glunty.com