ffmpeg -i input.mp4 output.avi |
Convert video format |
ffmpeg -i video.mp4 video.avi |
ffmpeg -i input.mp4 -vf scale=640:480 output.mp4 |
Resize video |
ffmpeg -i video.mp4 -vf scale=640:480 resized.mp4 |
ffmpeg -i input.mp4 -ss 00:00:30 -t 00:00:10 output.mp4 |
Trim video |
ffmpeg -i video.mp4 -ss 00:00:30 -t 00:00:10 trimmed.mp4 |
ffmpeg -i input.mp4 -vn -acodec copy output.mp3 |
Extract audio from video |
ffmpeg -i video.mp4 -vn -acodec copy audio.mp3 |
ffmpeg -i input.mp4 -an output.mp4 |
Remove audio from video |
ffmpeg -i video.mp4 -an no_audio.mp4 |
ffmpeg -i input.mp4 -b:v 1000k -b:a 128k output.mp4 |
Change video and audio bitrate |
ffmpeg -i video.mp4 -b:v 1000k -b:a 128k output.mp4 |
ffmpeg -i input.mp4 -r 24 output.mp4 |
Change frame rate |
ffmpeg -i video.mp4 -r 24 output.mp4 |
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4 |
Rotate video 90 degrees clockwise |
ffmpeg -i video.mp4 -vf "transpose=1" rotated.mp4 |
ffmpeg -i input.mp4 -vf "hue=s=0" output.mp4 |
Convert video to grayscale |
ffmpeg -i video.mp4 -vf "hue=s=0" grayscale.mp4 |
ffmpeg -i input.mp4 -vf "crop=640:360:0:0" output.mp4 |
Crop video |
ffmpeg -i video.mp4 -vf "crop=640:360:0:0" cropped.mp4 |
ffmpeg -i input.mp4 -vf "drawtext=text='Sample Text':x=10:y=10:fontsize=24:fontcolor=white" output.mp4 |
Add text overlay to video |
ffmpeg -i video.mp4 -vf "drawtext=text='Sample Text':x=10:y=10:fontsize=24:fontcolor=white" text_overlay.mp4 |
ffmpeg -i input.mp4 -vf "fps=30" output.mp4 |
Change frames per second (fps) |
ffmpeg -i video.mp4 -vf "fps=30" fps30.mp4 |
ffmpeg -i input.mp4 -vf "scale=1280:-1" output.mp4 |
Scale video width to 1280, keeping aspect ratio |
ffmpeg -i video.mp4 -vf "scale=1280:-1" scaled.mp4 |
ffmpeg -i input.mp4 -vf "setpts=2.0*PTS" output.mp4 |
Slow down video by 2x |
ffmpeg -i video.mp4 -vf "setpts=2.0*PTS" slow.mp4 |
ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" output.mp4 |
Speed up video by 2x |
ffmpeg -i video.mp4 -vf "setpts=0.5*PTS" fast.mp4 |
ffmpeg -i input.mp4 -af "atempo=2.0" output.mp4 |
Speed up audio by 2x |
ffmpeg -i video.mp4 -af "atempo=2.0" fast_audio.mp4 |
ffmpeg -i input.mp4 -af "atempo=0.5" output.mp4 |
Slow down audio by 2x |
ffmpeg -i video.mp4 -af "atempo=0.5" slow_audio.mp4 |
ffmpeg -i input.mp4 -vf "hflip" output.mp4 |
Flip video horizontally |
ffmpeg -i video.mp4 -vf "hflip" flipped.mp4 |
ffmpeg -i input.mp4 -vf "vflip" output.mp4 |
Flip video vertically |
ffmpeg -i video.mp4 -vf "vflip" flipped.mp4 |
ffmpeg -i input.mp4 -vf "eq=brightness=0.06:saturation=1.5" output.mp4 |
Adjust brightness and saturation |
ffmpeg -i video.mp4 -vf "eq=brightness=0.06:saturation=1.5" adjusted.mp4 |
ffmpeg -i input.mp4 -vf "curves=r='0/0 0.5/0.5 1/1'" output.mp4 |
Apply color curves |
ffmpeg -i video.mp4 -vf "curves=r='0/0 0.5/0.5 1/1'" curves.mp4 |
ffmpeg -i input.mp4 -vf "deshake" output.mp4 |
Stabilize video |
ffmpeg -i video.mp4 -vf "deshake" stabilized.mp4 |
ffmpeg -i input.mp4 -vf "fade=in:0:30" output.mp4 |
Apply fade-in effect |
ffmpeg -i video.mp4 -vf "fade=in:0:30" fadein.mp4 |
ffmpeg -i input.mp4 -vf "fade=out:300:30" output.mp4 |
Apply fade-out effect |
ffmpeg -i video.mp4 -vf "fade=out:300:30" fadeout.mp4 |
ffmpeg -i input.mp4 -vn -ar 44100 -ac 2 -b:a 192k output.mp3 |
Convert video to audio (MP3) |
ffmpeg -i video.mp4 -vn -ar 44100 -ac 2 -b:a 192k audio.mp3 |
ffmpeg -i input.mp3 -acodec libvorbis output.ogg |
Convert audio to OGG |
ffmpeg -i audio.mp3 -acodec libvorbis audio.ogg |
ffmpeg -i input.wav -acodec flac output.flac |
Convert audio to FLAC |
ffmpeg -i audio.wav -acodec flac audio.flac |
ffmpeg -i input.mp4 -vf "scale=iw/2:ih/2" output.mp4 |
Reduce video dimensions by half |
ffmpeg -i video.mp4 -vf "scale=iw/2:ih/2" reduced.mp4 |
ffmpeg -i input.mp4 -vf "scale=iw*2:ih*2" output.mp4 |
Double video dimensions |
ffmpeg -i video.mp4 -vf "scale=iw*2:ih*2" doubled.mp4 |
ffmpeg -i input.mp4 -vf "drawbox=x=50:y=50:w=120:h=120:[email protected]" output.mp4 |
Draw a box on the video |
ffmpeg -i video.mp4 -vf "drawbox=x=50:y=50:w=120:h=120:[email protected]" boxed.mp4 |
ffmpeg -i input.mp4 -vf "drawgrid=width=100:height=100:[email protected]" output.mp4 |
Draw grid on the video |
ffmpeg -i video.mp4 -vf "drawgrid=width=100:height=100:[email protected]" grid.mp4 |
ffmpeg -i input.mp4 -vf "eq=gamma=1.5" output.mp4 |
Adjust video gamma |
ffmpeg -i video.mp4 -vf "eq=gamma=1.5" gamma.mp4 |
ffmpeg -i input.mp4 -vf "setpts=N/FRAME_RATE/TB" output.mp4 |
Normalize frame timestamps |
ffmpeg -i video.mp4 -vf "setpts=N/FRAME_RATE/TB" normalized.mp4 |
ffmpeg -i input.mp4 -vf "geq='lum(X,Y)':'cb(X,Y)':128" output.mp4 |
Apply grayscale with equalization |
ffmpeg -i video.mp4 -vf "geq='lum(X,Y)':128" gray_equalized.mp4 |
ffmpeg -i input.mp4 -vf "scale=1280:720,setsar=1:1" output.mp4 |
Resize video and set aspect ratio |
ffmpeg -i video.mp4 -vf "scale=1280:720,setsar=1:1" resized_aspect.mp4 |
ffmpeg -i input.mp4 -c:v libx265 -crf 28 output.mp4 |
Encode video to H.265/HEVC |
ffmpeg -i video.mp4 -c:v libx265 -crf 28 hevc.mp4 |
ffmpeg -i input.mp4 -c:v libx264 -preset fast -crf 22 output.mp4 |
Encode video to H.264 with fast preset |
ffmpeg -i video.mp4 -c:v libx264 -preset fast -crf 22 h264_fast.mp4 |
ffmpeg -i input.mp4 -map 0:v -map 0:a -c:v copy -c:a copy output.mkv |
Remux video without re-encoding |
ffmpeg -i video.mp4 -map 0:v -map 0:a -c:v copy -c:a copy output.mkv |
ffmpeg -i input.mp4 -map 0:v -map 0:a:1 output.mp4 |
Select specific audio stream |
ffmpeg -i video.mp4 -map 0:v -map 0:a:1 output.mp4 |
ffmpeg -i input.mp4 -map 0:v:0 -map 0:a:0 -map 0:s:0 output.mkv |
Include subtitles in output |
ffmpeg -i video.mp4 -map 0:v:0 -map 0:a:0 -map 0:s:0 output.mkv |
ffmpeg -i input.mp4 -vf "movie=watermark.png [watermark]; [in][watermark] overlay=10:10 [out]" output.mp4 |
Add watermark to video |
ffmpeg -i video.mp4 -vf "movie=watermark.png [watermark]; [in][watermark] overlay=10:10 [out]" watermarked.mp4 |
ffmpeg -i input.mp4 -vf "yadif=0:-1:0" output.mp4 |
Deinterlace video |
ffmpeg -i video.mp4 -vf "yadif=0:-1:0" deinterlaced.mp4 |
ffmpeg -i input.mp4 -vf "fps=30,format=yuv420p" output.mp4 |
Set frame rate and pixel format |
ffmpeg -i video.mp4 -vf "fps=30,format=yuv420p" formatted.mp4 |
ffmpeg -i input.mp4 -c copy -f segment -segment_time 10 -reset_timestamps 1 output%03d.mp4 |
Split video into segments |
ffmpeg -i video.mp4 -c copy -f segment -segment_time 10 -reset_timestamps 1 output%03d.mp4 |
ffmpeg -i input.mp4 -vf "select='not(mod(n\,10))',setpts=N/FRAME_RATE/TB" output.mp4 |
Extract every 10th frame |
ffmpeg -i video.mp4 -vf "select='not(mod(n\,10))',setpts=N/FRAME_RATE/TB" extracted.mp4 |
ffmpeg -i input.mp4 -vf "thumbnail" -frames:v 1 thumb.png |
Create video thumbnail |
ffmpeg -i video.mp4 -vf "thumbnail" -frames:v 1 thumb.png |
ffmpeg -i input.mp4 -vf "scale=1280:-1" -c:v mjpeg -q:v 3 output.jpg |
Extract video frame to JPEG |
ffmpeg -i video.mp4 -vf "scale=1280:-1" -c:v mjpeg -q:v 3 frame.jpg |
ffmpeg -i input.mp4 -c:v vp9 -b:v 2M -c:a libvorbis output.webm |
Encode video to VP9 |
ffmpeg -i video.mp4 -c:v vp9 -b:v 2M -c:a libvorbis output.webm |
ffmpeg -i input.mp4 -vf "split [main][tmp]; [tmp] fifo, lutrgb="r=negval:g=negval:b=negval" [inv]; [main][inv] overlay" output.mp4 |
Create inverted video overlay |
ffmpeg -i video.mp4 -vf "split [main][tmp]; [tmp] fifo, lutrgb="r=negval:g=negval:b=negval" [inv]; [main][inv] overlay" inverted_overlay.mp4 |
ffmpeg -i input.mp4 -vf "scale=1280:720,setsar=1:1" -c:v libx264 -crf 23 -c:a aac -b:a 128k output.mp4 |
Convert video with custom resolution and audio codec |
ffmpeg -i video.mp4 -vf "scale=1280:720,setsar=1:1" -c:v libx264 -crf 23 -c:a aac -b:a 128k output.mp4 |
If I have some time, I will make a complete list with more choices.