FFmpeg Command Guide
Complete FFmpeg usage guide with various common commands, parameter explanations and practical application scenario examples
Format Conversion
basicConvert a video from one format to another
The output format is determined by the file extension. FFmpeg automatically selects an appropriate encoder.
Extract Audio
basicExtract the audio track from a video file
Extracts the audio stream from the video and saves it as MP3 while preserving original audio quality.
Capture Screenshot
basicCapture a single frame at a specific timestamp
Captures a single frame at 1 minute and 30 seconds. Commonly used for thumbnails or previews.
View Media Info
basicDisplay detailed media file information
Displays codec, duration, resolution, bitrate, and stream details when no output file is specified.
Convert Video to GIF
basicConvert a video clip to an animated GIF
Converts video to a 10 FPS GIF with 320px width. Commonly used for memes or short animations.
Batch Format Conversion
basicBatch convert multiple files to MP4 format
Batch converts all MOV files to MP4 using H.264 and AAC. Common for camera footage workflows.
Extract Frame Sequence
basicExport all frames as an image sequence
Extracts every frame as JPEG images (frame_0001.jpg, frame_0002.jpg, etc.).
Trim Video
basicExtract a specific time range from a video
Quickly trims a clip using stream copy to preserve original quality and speed up processing.
Merge Videos
basicConcatenate multiple video files into one
Merges multiple videos listed in filelist.txt without re-encoding.
Change Playback Speed
basicSpeed up or slow down video playback
Speeds up video by 2x (0.5*PTS). Use 2*PTS to slow down by 0.5x.
Resize Video
videoChange the video resolution
Resizes the video to 1280x720 pixels while preserving the original aspect ratio.
Compress Video
videoReduce video file size
Compresses the video using H.264. Lower CRF values produce higher quality. A typical range is 18–28.
Add Watermark
videoOverlay an image or text watermark on the video
Adds a PNG watermark image at position (10,10) in the top-left corner of the video.
Crop Video
videoCrop a specific region of the video
Crops a 640x360 region starting from position (100,100).
Rotate Video
videoRotate the video by 90°, 180°, or 270°
Transpose values: 0 = 90° CCW + vertical flip, 1 = 90° clockwise, 2 = 90° counter-clockwise, 3 = 90° clockwise + vertical flip.
Video Stabilization (Analysis)
videoAnalyze camera shake using vid.stab
Step 1: Analyzes camera shake and generates a transformation vector file.
Video Stabilization (Apply)
videoApply video stabilization
Step 2: Applies stabilization using the generated transform file. The smoothing parameter controls stabilization strength.
Deinterlace (YADIF)
videoRemove interlacing artifacts from video
Removes interlacing artifacts to make the video suitable for progressive displays.
Deinterlace (BWDIF)
videoConvert interlaced video to progressive
Uses the BWDIF filter to convert interlaced video to progressive scan for better playback quality.
Video Denoising
videoReduce noise and grain in video
Reduces visual noise and grain using the hqdn3d filter to improve overall video quality.
Adjust Audio Volume
audioIncrease or decrease audio volume
Boosts the audio volume by 50%. Use values below 1.0 to reduce volume.
Convert Audio Format
audioConvert audio from one format to another
Converts WAV audio to MP3 at 192 kbps, suitable for web distribution.
Trim Audio
audioExtract a specific time segment from audio
Extracts audio from 01:30 to 03:45 without re-encoding, preserving original quality.
Fade In / Fade Out
audioAdd fade-in and fade-out effects to audio
Applies a 3-second fade-in starting at 0s and a 3-second fade-out starting at 10s.
Audio Noise Reduction
audioReduce background noise in audio
Uses FFT-based noise reduction to reduce background noise. The nf parameter controls denoising strength.
Merge Audio Files
audioMerge multiple audio files into one
Merges multiple audio files in sequence without re-encoding, preserving original quality.
Change Sample Rate
audioAdjust the audio sample rate
Sets the audio sample rate to 44.1 kHz, the standard CD-quality sample rate.
Channel Conversion
audioConvert between mono and stereo
Converts stereo audio to mono. Set to 2 to convert mono to stereo.
Audio Equalizer
audioAdjust frequency response using EQ
Boosts the 1000 Hz frequency band by 5 dB to adjust tonal balance.
Dynamic Range Compression
audioApply audio dynamic range compression
Applies dynamic range compression to reduce loudness variation and make quiet parts louder.
Add Text Watermark
filterOverlay text watermark on video
Adds a white text watermark at position (10,10) with a font size of 24.
Blur Video
filterApply blur effect to video
Applies a blur effect to the video. The first parameter controls blur strength, and the second controls quality.
Color Correction
filterAdjust brightness, contrast, and saturation
Adjusts brightness (+0.1), contrast (1.2x), and saturation (1.5x).
Mirror Effect
filterCreate a vertical mirror effect
Creates a vertical mirror effect where the bottom half mirrors the top half.
Vintage Film Effect
filterApply old film / vintage movie effect
Adds film grain and vintage color curves to simulate an old movie look.
Sharpen Video
filterEnhance video details and clarity
Sharpens the video using the unsharp mask algorithm to enhance detail and clarity.
Edge Detection
filterDetect and highlight edges in video
Detects and highlights edges in the video, commonly used in computer vision workflows.
Color Space Conversion
filterConvert video color space
Converts video from BT.601 color space to BT.709 color space.
Convert to Grayscale
filterConvert color video to grayscale
Converts color video to grayscale by setting saturation to 0.
Negative Effect
filterInvert video colors
Inverts all color values to create a negative film effect.
Record RTMP Stream
streamRecord RTMP live stream to a local file
Records an RTMP live stream and saves it as an FLV file. Stream copy avoids re-encoding to reduce CPU usage.
Generate HLS Stream
streamConvert a video file to HLS streaming format
Converts an MP4 file to HLS format with 10-second segments, suitable for web streaming.
Push RTMP Stream
streamStream a local file to an RTMP server
Pushes a local video file to an RTMP server as a live stream, commonly used for live broadcasting.
Screen Recording
streamCapture and record desktop screen
Records the entire desktop on Windows. On Linux, use x11grab for screen capture.
Webcam Recording
streamRecord video from webcam device
Records video from a webcam device on Windows. Make sure to specify the correct device name.
Audio Input Recording
streamRecord audio from input device
Records audio from the default input device on Linux and saves it as a WAV file.
Multi-Bitrate HLS Stream
streamGenerate adaptive bitrate HLS streams
Generates multiple HLS variants (360p and 480p) for adaptive bitrate streaming under different network conditions.
Generate DASH Stream
streamConvert a video file to MPEG-DASH format
Converts an MP4 file to MPEG-DASH format for adaptive bitrate streaming.
Record RTSP Stream
streamRecord RTSP video stream
Records an RTSP video stream and saves it as an MP4 file. Commonly used for IP cameras and surveillance systems.
HTTP Upload Streaming
streamStream or upload video to an HTTP endpoint
Streams or uploads a video file to an HTTP server endpoint using POST requests.
Picture-in-Picture (PiP)
advancedCreate a picture-in-picture overlay
Creates a picture-in-picture effect by scaling the secondary video to 25% size and placing it in the top-right corner.
GPU-Accelerated Transcoding
advancedUse GPU hardware acceleration for video encoding
Uses NVIDIA GPU acceleration to significantly speed up H.264 video encoding.
Multi-Stream Composition
advancedProcess and combine multiple video streams
Combines two video streams side by side. Use vstack for vertical stacking.
Timecode Overlay
advancedBurn timecode into video frames
Overlays SMPTE-style timecode in the top-left corner using hours:minutes:seconds format.
Edit Video Metadata
advancedModify container metadata fields
Edits video container metadata such as title, year, and author.
Video Quality Analysis (PSNR)
advancedMeasure video quality using PSNR
Compares compressed and source videos and outputs PSNR values to evaluate quality loss.
Bitrate Control (CRF + VBV)
advancedControl quality and limit peak bitrate
Uses CRF for quality-based encoding while applying VBV to cap peak bitrate.
Progressive to Interlaced
advancedConvert progressive video to interlaced format
Converts progressive video to top-field-first interlaced format for broadcast workflows.
Frame Rate Conversion
advancedChange video frame rate
Converts video to 30 FPS using frame duplication or dropping as needed.
Deblocking Filter
advancedReduce compression blocking artifacts
Reduces blocking artifacts caused by aggressive compression to improve visual quality.
Batch Add Watermark
utilityAdd the same watermark to all videos in a folder
Batch process all MP4 files in the folder and add a watermark to the top-left corner.
Batch Resize Videos
utilityResize all videos in a folder to a unified resolution
Resize all MP4 files to 1280x720 resolution, suitable for standardizing video specs.
Batch Extract Audio
utilityExtract audio from all videos in a folder
Batch extract audio from all MP4 files and save as MP3 format.
Batch Generate Thumbnails
utilityGenerate thumbnails for all videos in a folder
Generate one thumbnail for each video at the 5-second mark.
Batch Video Compression
utilityCompress all videos in a folder to reduce file size
Batch compress all MP4 files using CRF 23 and 128 kbps audio to balance quality and file size.
Video Duration Analysis
utilityGet duration of all videos in a folder
Use ffprobe to output the duration of each video, useful for calculating total runtime.
Export Video Metadata
utilityExport detailed video metadata to a file
Export detailed format and stream information to a JSON file for further analysis.
Analyze Frame Information
utilityAnalyze video frame types and timestamps
Display detailed information for each frame, including frame type (I/P/B) and timestamps.
Analyze Bitrate Information
utilityAnalyze bitrate and frame-level stream details
Analyze stream-level and frame-level information to inspect bitrate and encoding behavior.
Validate Video File
utilityCheck video file integrity and compatibility
Validate video file integrity and compatibility. Only errors will be shown.
Common Scenarios & Application Examples
Batch Video Format Conversion
Convert all MOV files in a folder to MP4 format while preserving original quality
Use a Windows batch loop to convert all MOV files. Commonly used for processing videos imported from cameras.
Generate Thumbnail Gallery
Extract frames from a video at regular intervals to create a thumbnail set
Extract one frame per minute, scale to 320px width (height auto-scaled), and save as a numbered image sequence.
Video Trimming and Merging
Extract clips from a long video or merge multiple videos
Use stream copy (no re-encoding) to quickly extract a clip from 10:00 to 15:30 while preserving original quality.
Rotate Video
Rotate a video by 90°, 180°, or 270°
Transpose options: 0 = 90° CCW + vertical flip, 1 = 90° CW, 2 = 90° CCW, 3 = 90° CW + vertical flip.
Optimized Video Compression
Optimize compression settings for the best quality-to-size ratio
Use the 'slower' preset for better compression efficiency. CRF 18 provides high quality, with 128 kbps audio bitrate.