Essential FFmpeg Commands
From generating mobile-friendly gallery thumbnails to compressing heavy media streams for cloud synchronization, master the most powerful CLI tool for audio and video manipulation.
FFmpeg v7.0 (Diorite)
The industry standard framework for decoding, encoding, transcoding, muxing, and demuxing. Version 7.0 introduces native VVC/H.266 decoding and multi-threading optimizations.
Format Conversion
Convert between container formats quickly. Using -c copy avoids re-encoding, preserving original quality.
High-Efficiency Compression
Compress files safely for cloud uploading. Adjust CRF (Constant Rate Factor) between 18-28. Higher means smaller file but lower quality.
Extract Snippet / Trimming
Fast seeking and cutting. -ss is the start time, -t is duration. Putting -ss before -i makes it significantly faster.
Scale / Change Resolution
Scale videos using video filters (-vf). Using -1 for one dimension automatically calculates the correct aspect ratio to prevent distortion.
Demuxing (Split Audio/Video)
Strip audio (-an) or video (-vn) streams completely. Useful for creating silent background loops or extracting podcast audio.
Concatenate / Merge Videos
Merge multiple identical-format videos into one. Create a text file (list.txt) with 'file' syntax, then use the concat demuxer.
Screen Recording
Record your desktop natively. Use gdigrab for Windows. (For macOS, replace with -f avfoundation -i '1:0').
Extract Frames for Analysis
Extract image frames from a video stream. Essential for feeding visual data into content-based similarity algorithms or AI models.
Spatial Cropping
Remove black bars or crop a 16:9 video to a 1:1 square. x and y define the starting top-left coordinates.
High-Quality GIF Generator
Generate a global color palette first, then render the GIF to prevent color distortion and jagged edges.
Overlay Watermark
Overlay an image onto a video. Use basic math in the coordinates to position it accurately (e.g., bottom-right corner).
Rotate & Mirror Flip
Fix upside-down phone recordings using transpose, or create mirror effects using hflip/vflip.
Volume & Audio Fades
Adjust background music volume or eliminate popping sounds by adding audio fade-in and fade-out effects.
Multi-Track Mapping
Select specific video and audio tracks from MKV/MP4 files that contain multiple languages or commentaries.
Change Framerate (FPS)
Force a 60fps video down to 24fps or 30fps to accommodate older decoding hardware or reduce processing load.
Pro Tip: Filtergraph Chaining
If you need to resize AND crop a video simultaneously, do not run FFmpeg twice. Chain the commands in a single -vf flag separated by a comma (e.g., -vf "scale=1920:-1,crop=1080:1080"). This ensures the video is only decoded and encoded once, saving massive amounts of compute time.
Explore More#ffmpeg-dev
FFmpeg Building Guide
ArticleA detailed step-by-step guide on how to compile FFmpeg from source on different platforms.
FFmpeg and x264 Compilation Guide
ArticleA detailed step-by-step guide on how to compile FFmpeg from source and integrate x264 on different platforms.
Essential FFmpeg Commands
ArticleA quick reference guide for essential FFmpeg commands covering common operations like media processing, format conversion, and compression optimization.
FFmpeg C++ Video Player Development Guide
ArticleA detailed step-by-step guide on how to develop a simple C++ video player using the FFmpeg library.
FFmpeg 7 Compilation Guide
ArticleA detailed step-by-step guide on how to compile FFmpeg 7 from source on different platforms.
FFmpeg FFplay.c Source Code Analysis
ArticleA detailed analysis of the FFplay.c source code in FFmpeg, helping developers understand the implementation principles of video players.
FFmpeg + OpenSSL Compilation Guide
ArticleA detailed step-by-step guide on how to compile FFmpeg from source and integrate OpenSSL on different platforms for HTTPS streaming support.
FFmpeg + OpenCV Face Recognition and Video Processing
ArticleA detailed demonstration of how to use FFmpeg and OpenCV on mobile platforms to implement face recognition and video processing features.
FFmpeg + OpenCV Mask Processing and Video Analysis
ArticleA detailed demonstration of how to use FFmpeg and OpenCV on mobile platforms to implement mask processing and video analysis features.
