Tool cheatsheet
FFmpeg Cheatsheet
Convert, trim, resize, compress and inspect audio and video from the command line with ffmpeg and ffprobe.
Convert and inspect
- Check the version — Print the FFmpeg version and build options.
- Inspect a file — Show streams, codecs, duration and bit rate.
- Inspect a file as JSON — Print format and stream details in a machine-readable form.
- Convert between formats — Convert a file, choosing the format from the output file name.
- Change the container without re-encoding — Copy the streams as they are. This is fast and lossless.
- Overwrite without asking — Replace the output file if it exists. Use -n to never overwrite.
- List supported encoders — Show the encoders your build supports.
Video
- Compress a video — Re-encode with H.264. Lower CRF means higher quality and a larger file; 23 is the default and 28 is smaller.
- Compress with H.265 — Encode with HEVC for smaller files. Add -tag:v hvc1 for Apple compatibility.
- Resize a video — Scale to 1280 pixels wide and keep the aspect ratio. -2 keeps the height divisible by two.
- Cut a section — Cut from 30 seconds for one minute. Placing -ss before -i seeks quickly; add -c copy to avoid re-encoding.
- Change the frame rate — Set the output to 30 frames per second.
- Speed up a video — Play at double speed, adjusting audio to match.
- Rotate a video — Rotate 90 degrees clockwise.
- Crop a video — Keep a 640 by 360 area starting at x=100, y=50.
- Overlay a logo — Place a PNG 10 pixels from the top right corner.
- Burn in subtitles — Draw subtitles permanently onto the picture.
- Join videos — Join files that share the same codecs, using a list file with lines like: file 'part1.mp4'.
Audio
- Extract the audio — Save the audio track as MP3 and drop the video.
- Extract the audio without re-encoding — Copy the existing audio stream. The file extension must suit the codec.
- Remove the audio — Drop every audio stream from the output.
- Replace the audio track — Keep the video and use audio from another file.
- Normalize loudness — Adjust the volume to a consistent loudness.
- Change the volume — Make the audio 50% quieter. Use 2.0 for twice as loud.
Images, GIFs and streams
- Save a frame as an image — Grab one frame at 10 seconds.
- Save a frame every second — Write one image per second of video.
- Make a video from images — Turn numbered images into a 30 fps video.
- Create a GIF — Make a GIF 480 pixels wide at 12 frames per second.
- Create an HLS stream — Split a video into segments for streaming over HTTP.
- Record the screen on Linux — Capture an X11 screen at 30 frames per second.
- Use hardware encoding (NVIDIA) — Encode on an NVIDIA GPU for much faster results at some cost in compression.
Related cheatsheets
- Ansible 2 cheatsheet — Run ad-hoc commands and playbooks, manage inventories, roles, collections and secrets with Ansible.
- Argo CD 3 cheatsheet — Install Argo CD, define Applications declaratively, and manage sync, diffs, history and rollbacks with the argocd CLI.
- AWS CLI 2 cheatsheet — Configure credentials and manage S3, EC2, Lambda, logs, containers and secrets with the AWS CLI v2.
- Azure CLI 2 cheatsheet — Sign in and manage resource groups, VMs, web apps, storage, Kubernetes, registries and secrets with the az command.
- Bash and Linux 5 cheatsheet — Everyday shell and Linux commands for files, searching text, permissions, processes and servers.
- Claude API cheatsheet — Call Claude from Python, TypeScript or curl: messages, streaming, thinking, tools, structured output, caching, batches and error handling.