ffmpeg -i input.mp4 -vf "scale=1280:-1" -c:v libx264 -preset slow -crf 24 -c:a aac -b:a 128k compressed.mp4
Parameter | Description |
---|---|
-i input.mp4 |
Specifies the input file |
-vf "scale=1280:-1" |
Video filter to scale width to 1280px while maintaining aspect ratio |
-c:v libx264 |
Sets the video codec to H.264 |
-preset slow |
Sets encoding preset (slower = better compression) |
-crf 24 |
Sets quality (higher value = lower quality, smaller file) |
-c:a aac |
Sets audio codec to AAC |
-b:a 128k |
Sets audio bitrate to 128 kbps |
ffmpeg -i input.mp4 -vf "scale=640:-1" -c:v libx264 -preset veryslow -crf 28 -c:a aac -b:a 96k email_compressed.mp4
Creates a highly compressed version suitable for email attachments with reduced resolution.
ffmpeg -i input.mp4 -vf "scale='min(1280,iw)':-1" -c:v libx264 -preset medium -crf 26 -c:a aac -b:a 96k -fs 8M discord.mp4
Uses the -fs option to limit file size to 8MB maximum for Discord uploads.
ffmpeg -i input.mp4 -vf "scale=1280:-1,fps=24" -c:v libx264 -preset slow -crf 24 -c:a aac -b:a 128k framerate_reduced.mp4
Reduces framerate to 24fps alongside other compression techniques for smaller file size.