ffmpeg
Video, audio and media commands for conversion, editing, compression and streaming.
Basic Usage
Simple one-liners to perform basic ffmpeg operations.
Convert media
Converts a file from one format to another.
ffmpeg -i input.mov output.mp4
Show media info
Displays stream details and metadata of a media file.
ffmpeg -i input.mp4
Trimming and Cutting
Cut or trim sections of media based on time without re-encoding or with re-encoding.
Cut clip without re-encoding
Cuts a portion of the video losslessly.
ffmpeg -ss 00:00:10 -to 00:00:20 -i input.mp4 -c copy output.mp4
Trim and re-encode
Trims part of a video and re-encodes it.
ffmpeg -ss 10 -t 10 -i input.mp4 output.mp4
Video Filters
Apply visual transformations to video content.
Rotate 90 degrees clockwise
Rotates the video frame clockwise.
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
Flip vertically
Flips the video upside down.
ffmpeg -vf "vflip" -i input.mp4 output.mp4
Crop video
Crops a portion of the video with specified dimensions.
ffmpeg -vf "crop=640:360:0:0" -i input.mp4 output.mp4
Audio Filters
Modify or extract audio from media files.
Remove audio track
Outputs the video without any audio.
ffmpeg -i input.mp4 -an output.mp4
Extract audio
Extracts the audio track and saves it as MP3.
ffmpeg -i input.mp4 -q:a 0 -map a output.mp3
Change audio volume
Increases the audio volume by 50%.
ffmpeg -i input.mp4 -af "volume=1.5" output.mp4
Compression and Quality
Reduce file size or control video/audio quality using encoding options.
Compress video (H.264)
Encodes video using H.264 codec with default quality.
ffmpeg -i input.mp4 -vcodec libx264 -crf 23 output.mp4
Lower video bitrate
Compresses video by setting a lower bitrate.
ffmpeg -i input.mp4 -b:v 1000k output.mp4
Compress audio (MP3)
Compresses audio using MP3 codec at 192 kbps.
ffmpeg -i input.wav -b:a 192k output.mp3
Images and Thumbnails
Extract frames, generate thumbnails or convert between image sequences and video.
Extract frame at specific time
Captures a single frame at the 1-second mark.
ffmpeg -ss 00:00:01 -i input.mp4 -frames:v 1 output.jpg
Generate thumbnails every 10 seconds
Creates thumbnail images at 10-second intervals.
ffmpeg -i input.mp4 -vf fps=1/10 thumb_%03d.jpg
Convert image sequence to video
Converts sequentially numbered images to a video.
ffmpeg -framerate 24 -i img_%03d.png output.mp4
Streams and Codecs
Inspect or change audio/video codecs and manage streams.
Change video codec to H.265
Re-encodes video using H.265 (HEVC).
ffmpeg -i input.mp4 -c:v libx265 output.mp4
Copy all streams without re-encoding
Copies all media streams directly to a new container.
ffmpeg -i input.mkv -c copy output.mp4
Metadata
Add or modify metadata such as title, creation time and language.
Set title metadata
Sets the title field in the media metadata.
ffmpeg -i input.mp4 -metadata title="My Title" output.mp4
Set creation time
Adds or overrides the creation timestamp in metadata.
ffmpeg -i input.mp4 -metadata creation_time="2024-01-01T12:00:00" output.mp4
Set stream language
Specifies the language for a particular audio stream.
ffmpeg -i input.mp4 -metadata:s:a:0 language=eng output.mp4
Subtitles
Extract, embed or burn subtitles into videos.
Extract subtitles from MKV
Saves subtitle stream to an external .srt file.
ffmpeg -i input.mkv -map 0:s:0 subs.srt
Burn subtitles into video
Renders external subtitles directly into the video.
ffmpeg -i input.mp4 -vf subtitles=subs.srt output.mp4
Embed subtitles without burning
Adds subtitles to a container without rendering them.
ffmpeg -i input.mp4 -i subs.srt -c copy -c:s mov_text output.mp4
Streaming and Network
Stream or receive media over the network using ffmpeg.
Stream to RTMP server
Sends a media stream to a live RTMP endpoint.
ffmpeg -re -i input.mp4 -f flv rtmp://server/live/streamkey
Download HLS stream
Saves a stream from an HLS URL into a local file.
ffmpeg -i https://example.com/playlist.m3u8 -c copy output.ts