resize
Change video resolution with preset scales or custom dimensions while preserving quality.
Overview
The resize command is your go-to tool for changing video resolution, whether you're optimizing for specific platforms (YouTube, Instagram, TikTok), reducing file sizes for mobile devices, or upscaling content for high-resolution displays. It intelligently maintains aspect ratios, provides industry-standard resolution presets, and offers advanced controls for professional-grade output.
Key Features:
- 🎯 Preset resolutions from 360p to 8K (4320p)
- 🔄 Custom dimensions with automatic aspect ratio handling
- 🎬 Multiple codec support (H.264, H.265, VP9, AV1)
- ⚡ Hardware acceleration for faster processing
- 🎨 Built-in rotation, flipping, and cropping tools
- 📐 Smart padding to ensure codec compatibility
Common Use Cases:
- Preparing videos for social media platforms
- Creating mobile-optimized versions for bandwidth savings
- Upscaling old content to modern standards
- Converting between aspect ratios (16:9 ↔ 4:3 ↔ 1:1)
- Batch processing entire video libraries
Upscaling vs Downscaling: Downscaling (e.g., 4K → 1080p) preserves quality well. Upscaling (e.g., 480p → 1080p) cannot create detail that wasn't in the original - use higher bitrates and better codecs for best results when upscaling.
Usage
Options
Basic Options
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--output | -o | string | Auto | Output file or directory path |
--scale | -s | string | 1080p | Resolution: 360p, 480p, 720p, 1080p, 1440p, 2160p (4K), 4320p (8K), or WxH |
--verbose | -v | boolean | false | Show detailed FFmpeg output |
--dry-run | boolean | false | Preview command without executing |
Video Codec & Quality
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--codec | -c | string | h264 | Video codec: h264, h265, vp9, av1 |
--quality | -q | number | 23 | CRF quality: 0-51, lower is better quality |
--preset | string | medium | Encoding preset: ultrafast, fast, medium, slow, veryslow | |
--bitrate | -b | string | Target bitrate (e.g., 5M for 5 Mbps, 10M for 10 Mbps) | |
--two-pass | boolean | false | Use two-pass encoding for optimal quality distribution |
Resolution & Aspect Ratio
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--aspect | -a | string | Force aspect ratio: 16:9, 4:3, 21:9, 1:1 | |
--fps | number | Output frame rate (e.g., 24, 30, 60) | ||
--scale-algo | string | lanczos | Scaling algorithm: bilinear, bicubic, lanczos, spline |
Transformation
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--rotate | number | Rotate video: 90, 180, 270 degrees | ||
--flip | string | Flip video: horizontal, vertical, both | ||
--crop | string | Crop video (width:height:x:y or preset: 16:9, 4:3, 1:1) | ||
--deinterlace | boolean | false | Deinterlace video (for interlaced sources like old DVDs) |
Performance & Output
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--format | string | Output format: mp4, mkv, webm, avi | ||
--threads | number | auto | Number of CPU threads for encoding (default: auto-detect) | |
--hw-accel | boolean | false | Enable hardware acceleration (GPU encoding, 5-10x faster) | |
--no-audio | boolean | false | Remove audio track from output |
Flag Details
--scale - Resolution Control
Specify target resolution using presets or custom dimensions:
Preset Values:
360p= 640×360 (mobile, low bandwidth)480p= 854×480 (SD quality)720p= 1280×720 (HD)1080p= 1920×1080 (Full HD) ← default1440p= 2560×1440 (QHD)2160p= 3840×2160 (4K UHD)4320p= 7680×4320 (8K UHD)
Custom Dimensions:
- Format:
WIDTHxHEIGHT(e.g.,1920x1080,1280x720) - Dimensions are automatically rounded to even numbers (required for H.264/H.265)
- Aspect ratio is preserved with letterboxing/pillarboxing if needed
Learn More:
--codec - Video Encoder
Choose the video codec based on compatibility, quality, and file size needs:
H.264 (h264) - Default
- Compatibility: Universal (all devices, browsers, players)
- Encoding Speed: Fast
- Compression: Good
- File Size: Baseline reference
- Use When: Maximum compatibility needed, live streaming, quick encoding
H.265 (h265) - HEVC
- Compatibility: Modern devices (2016+), some browsers
- Encoding Speed: Slow (2-3x longer than H.264)
- Compression: Excellent (40-50% smaller than H.264 at same quality)
- File Size: Much smaller
- Use When: 4K video, storage optimization, modern device distribution
VP9 (vp9)
- Compatibility: Web browsers, YouTube
- Encoding Speed: Very slow
- Compression: Excellent (similar to H.265)
- File Size: Small
- Use When: WebM format, YouTube uploads, open-source projects
AV1 (av1)
- Compatibility: Latest browsers/devices (2020+)
- Encoding Speed: Extremely slow
- Compression: Best (20-30% better than H.265)
- File Size: Smallest
- Use When: Future-proofing, maximum compression, latest platforms
Learn More:
--quality - CRF (Constant Rate Factor)
CRF controls encoding quality from 0 (lossless) to 51 (worst quality). Unlike bitrate, CRF adapts to video complexity.
Recommended Values:
- 15-18: Near-lossless, master copies, archival (very large files)
- 20-23: High quality, professional distribution, streaming ← 23 is default
- 24-28: Good quality, web delivery, mobile
- 29-35: Low quality, preview/draft, maximum compression
Quality vs File Size:
- Each +6 CRF roughly halves file size
- Visual quality degrades more noticeably above CRF 28
- H.265/VP9 can use +4-6 CRF higher than H.264 for same perceived quality
When Upscaling: Use lower CRF values (18-20) to compensate for quality loss. Upscaling cannot create detail that wasn't in the original source.
Learn More:
--preset - Encoding Speed vs Compression
Presets control how much time FFmpeg spends optimizing compression. Slower = better compression.
Available Presets:
ultrafast- 10x faster, +20-30% larger filessuperfast- 5x faster, +15-20% larger filesveryfast- 3x faster, +10-15% larger filesfaster- 2x faster, +5-10% larger filesfast- 1.5x faster, +5% larger filesmedium- Balanced speed/quality ← defaultslow- 1.5x slower, 5-10% smaller files, better qualityslower- 2x slower, 10-15% smaller files, better qualityveryslow- 3x+ slower, 15-20% smaller files, best quality
Recommendations:
- Quick tests:
fastorfaster - Production:
sloworveryslow - Live streaming:
ultrafastorveryfast - Archival/Distribution:
veryslow+ two-pass
Learn More:
--bitrate - Target Bitrate
Set a target bitrate in Mbps. Overrides CRF-based quality control.
Format:
2M= 2 Mbps (megabits per second)5M= 5 Mbps10M= 10 Mbps
Recommended Bitrates by Resolution:
| Resolution | H.264 Bitrate | H.265 Bitrate | Use Case |
|---|---|---|---|
| 360p | 0.5-1 Mbps | 0.3-0.7 Mbps | Mobile 3G |
| 480p | 1-2 Mbps | 0.7-1.5 Mbps | Mobile 4G |
| 720p | 2.5-5 Mbps | 1.5-3 Mbps | HD streaming |
| 1080p | 5-8 Mbps | 3-5 Mbps | Full HD |
| 1440p | 10-15 Mbps | 6-10 Mbps | QHD |
| 4K (2160p) | 20-40 Mbps | 15-25 Mbps | Ultra HD |
CRF vs Bitrate: CRF provides better quality distribution (more bits for complex scenes). Use bitrate when you need predictable file sizes or streaming compliance.
--aspect - Force Aspect Ratio
Override the output aspect ratio, adding letterboxing/pillarboxing as needed.
Common Ratios:
16:9- Widescreen (YouTube, TV, monitors)4:3- Classic TV, older content21:9- Ultrawide cinema1:1- Square (Instagram posts, profile videos)9:16- Vertical (Instagram Stories, TikTok, Reels)
Behavior:
- Content is scaled to fit within the specified ratio
- Black bars (letterboxing/pillarboxing) added if necessary
- Original video is never stretched or distorted
--fps - Frame Rate
Change the output frame rate (frames per second).
Common Frame Rates:
24- Cinema standard, film look25- PAL video standard30- NTSC video standard, most web content60- High frame rate, smooth motion, gaming120- Very smooth, gaming, sports
Note: Increasing FPS requires interpolation (creating new frames) which may introduce artifacts. Decreasing FPS is straightforward but may appear choppy.
--scale-algo - Scaling Algorithm
Choose the algorithm used for resizing pixels.
Available Algorithms:
Lanczos (default) - Best Quality
- Highest quality, sharpest results
- Slightly slower
- Best for: Downscaling, professional work
Bicubic - Balanced
- Good quality, smooth results
- Moderate speed
- Best for: General use, slight softness preferred
Bilinear - Fast
- Lower quality, softer results
- Fastest algorithm
- Best for: Quick previews, when speed matters
Spline - Smooth
- Very smooth, can be slightly soft
- Good speed
- Best for: Artistic looks, reducing aliasing
Learn More:
--rotate - Rotation
Rotate video by specified degrees. Metadata-based rotation is automatically corrected.
Values: 90, 180, 270 (degrees clockwise)
Examples:
- Portrait to landscape:
--rotate 90 - Upside-down correction:
--rotate 180 - Landscape to portrait:
--rotate 270
--flip - Mirroring
Flip video horizontally, vertically, or both.
Values:
horizontal- Mirror left/rightvertical- Mirror top/bottomboth- Both axes (equivalent to 180° rotation + horizontal flip)
--crop - Cropping
Remove portions of the video frame.
Format Options:
Preset Ratios:
16:9- Widescreen crop4:3- Classic crop1:1- Square crop (centered)
Custom Crop:
- Format:
width:height:x:y width- Crop width in pixelsheight- Crop height in pixelsx- X offset from lefty- Y offset from top
Example: --crop 1920:1080:0:140 (crop 1920×1080 starting at top-left with 140px offset from top)
--two-pass - Two-Pass Encoding
Enable two-pass encoding for optimal quality at a target bitrate.
How It Works:
- First Pass: Analyzes entire video, collects statistics
- Second Pass: Encodes video using statistics for optimal bit distribution
Advantages:
- Better quality at same file size
- More efficient bitrate usage
- Smoother quality across entire video
Disadvantages:
- Takes 2x time (processes video twice)
- Requires temporary disk space for pass data
When to Use:
- Target bitrate is specified (
--bitrate) - Quality is critical (final distribution)
- File size must meet strict requirements
--hw-accel - Hardware Acceleration
Enable GPU-accelerated encoding (NVIDIA, AMD, Intel, Apple Silicon).
Speed Improvement: 5-10x faster encoding
Requirements:
- Compatible GPU with hardware encoder
- Proper drivers installed
- FFmpeg compiled with hardware support
Limitations:
- Slightly lower quality than CPU encoding
- Not all codecs supported on all GPUs
- May have limited preset/option support
Supported:
- NVIDIA NVENC (h264, h265)
- Intel Quick Sync (h264, h265)
- AMD VCE (h264, h265)
- Apple VideoToolbox (h264, h265)
Learn More:
Resolution Presets
| Preset | Resolution | Aspect Ratio | Common Use |
|---|---|---|---|
360p | 640x360 | 16:9 | Very low bandwidth, preview |
480p | 854x480 | 16:9 | Mobile, low bandwidth |
720p | 1280x720 | 16:9 | HD, web streaming |
1080p | 1920x1080 | 16:9 | Full HD, standard distribution |
1440p | 2560x1440 | 16:9 | QHD, gaming, high-end displays |
2160p | 3840x2160 | 16:9 | 4K/UHD, premium content |
4320p | 7680x4320 | 16:9 | 8K/UHD, cinema-grade |
Examples
Basic Resizing
Folder Support
Advanced Codec Options
Custom Aspect Ratio
Frame Rate Control
Rotation and Flip
Cropping
Hardware Acceleration
Bitrate Control
Dry Run Preview
# Preview resize operation
mediaproc video resize video.mp4 --scale 720p --dry-run
Output:
[DRY RUN] Would execute:
ffmpeg -i video.mp4 -vf scale=1280:720 -c:v libx264 -crf 23 -c:a copy video_1280x720.mp4
Input: video.mp4 (1920x1080)
Output: 1280x720
Scale: 720p preset
Batch Resizing
# Resize all MP4 files to 720p
for file in *.mp4; do
mediaproc video resize "$file" --scale 720p -o 720p/
done
# Create multiple versions
for file in *.mp4; do
mediaproc video resize "$file" --scale 1080p -o 1080p/
mediaproc video resize "$file" --scale 720p -o 720p/
mediaproc video resize "$file" --scale 480p -o 480p/
done
Use Cases
Mobile Optimization
Reduce resolution for mobile devices and data savings:
# Standard mobile (720p)
mediaproc video resize video.mp4 --scale 720p
# Low bandwidth mobile (480p)
mediaproc video resize video.mp4 --scale 480p
# Very low bandwidth (custom small size)
mediaproc video resize video.mp4 -w 640
Web Streaming
Create appropriate sizes for web delivery:
# Standard web (1080p)
mediaproc video resize source.mp4 --scale 1080p -o web-hd.mp4
# Medium quality (720p)
mediaproc video resize source.mp4 --scale 720p -o web-sd.mp4
# Low bandwidth (480p)
mediaproc video resize source.mp4 --scale 480p -o web-mobile.mp4
Social Media
Resize for platform requirements:
# Instagram feed (1080x1080)
mediaproc video resize video.mp4 -w 1080 -h 1080 --pad
# Instagram story (1080x1920 vertical)
mediaproc video resize horizontal.mp4 -w 1080 -h 1920 --pad
# Twitter (1280x720 recommended)
mediaproc video resize video.mp4 --scale 720p
# TikTok (1080x1920 vertical)
mediaproc video resize video.mp4 -w 1080 -h 1920 --pad
# YouTube thumbnail video (1920x1080)
mediaproc video resize video.mp4 --scale 1080p
4K Downscaling
Convert high-resolution footage to standard sizes:
# 4K to standard HD
mediaproc video resize 4k-footage.mp4 --scale 1080p
# 4K to gaming/monitor standard
mediaproc video resize 4k-footage.mp4 --scale 1440p
# 4K to mobile
mediaproc video resize 4k-footage.mp4 --scale 720p
Adaptive Streaming
Create multiple resolutions for adaptive bitrate:
# Create streaming ladder
mediaproc video resize source.mp4 --scale 1080p -o 1080p.mp4
mediaproc video resize source.mp4 --scale 720p -o 720p.mp4
mediaproc video resize source.mp4 --scale 480p -o 480p.mp4
# Then transcode each to different bitrates
mediaproc video transcode 1080p.mp4 --bitrate 5M -o 1080p-5mbps.mp4
mediaproc video transcode 720p.mp4 --bitrate 2.5M -o 720p-2.5mbps.mp4
mediaproc video transcode 480p.mp4 --bitrate 1M -o 480p-1mbps.mp4
Email-Friendly Videos
Create small videos for email attachments:
# Small resolution + compression
mediaproc video resize large-video.mp4 --scale 480p -o small.mp4
mediaproc video compress small.mp4 -q low -o email-ready.mp4
Technical Details
Aspect Ratio Preservation
The plugin automatically maintains aspect ratio:
Width only specified:
- Height calculated to maintain aspect ratio
- No distortion
Height only specified:
- Width calculated to maintain aspect ratio
- No distortion
Both specified (without --pad):
- Scales to fit within dimensions
- Maintains aspect ratio
- May not use full width or height
Both specified (with --pad):
- Scales to fit
- Adds black bars (letterbox/pillarbox)
- Fills exact dimensions
Scaling Algorithm
Uses FFmpeg's bicubic scaling (high quality):
# Downscaling (4K to 1080p)
-vf scale=1920:1080
# Upscaling (720p to 1080p) - not recommended
-vf scale=1920:1080
Even Dimensions
Video codecs require even dimensions (divisible by 2):
- Input: 1920x1080 → Valid ✓
- Input: 1921x1080 → Adjusted to 1920x1080 ✓
- Custom: 1281x720 → Adjusted to 1280x720 ✓
The plugin automatically ensures even dimensions.
Quality Preservation
Resizing uses default CRF 23 for re-encoding:
- Minimal quality loss with good compression
- Same as original if source is lower quality
- Can combine with compress for more size reduction
Padding Behavior
When --pad is used:
# 16:9 video → 1:1 square
mediaproc video resize 1920x1080.mp4 -w 1080 -h 1080 --pad
# Result: Video scaled to 1080x608, black bars top/bottom
# 1:1 square → 16:9
mediaproc video resize 1080x1080.mp4 -w 1920 -h 1080 --pad
# Result: Video scaled to 1080x1080, black bars left/right
Performance Considerations
Processing Speed
Resizing speed depends on:
- Resolution change: Larger changes take longer
- Downscaling: Fast (throwing away pixels)
- Upscaling: Slower (interpolating pixels)
- Video length: Proportional to duration
Approximate speeds (1080p to 720p):
- ~0.5-1x real-time for downscaling
- ~0.3-0.5x real-time for upscaling
Disk Usage
No temporary files created. Output written directly.
Memory Usage
Memory scales with source resolution:
- 1080p: ~500 MB RAM
- 4K: ~2 GB RAM
Error Handling
Common Errors
No dimensions specified:
Error: Must specify --scale or --width/--height
Invalid preset:
Error: Invalid scale preset 'abc'
Supported: 480p, 720p, 1080p, 1440p, 4k
Dimensions too large:
Error: Output dimensions exceed reasonable limits
Maximum: 7680x4320 (8K)
Invalid dimensions:
Error: Width and height must be positive integers
Best Practices
- Downscale only: Upscaling reduces quality
- Use presets: Easier than custom dimensions
- Test with --dry-run: Preview before processing
- Combine with compress: Further reduce file size after resizing
- Keep originals: Never resize source files
- Match aspect ratio: Avoid distortion
- Use padding for social: Exact dimensions with --pad
- Batch process: Create multiple sizes efficiently
Troubleshooting
Output Looks Distorted
Video appears stretched or squashed:
Cause: Specified dimensions don't match source aspect ratio
Solution 1: Use preset
mediaproc video resize video.mp4 --scale 1080p
Solution 2: Use padding
mediaproc video resize video.mp4 -w 1920 -h 1080 --pad
Solution 3: Specify only width or height
mediaproc video resize video.mp4 -w 1920
Quality Loss
Resized video has artifacts or looks blurry:
Cause 1: Upscaling from lower resolution
- Don't upscale, keep original or downscale only
Cause 2: Too aggressive downscaling
# Better: Gradual downscaling
mediaproc video resize 4k.mp4 --scale 1440p
mediaproc video resize output_2560x1440.mp4 --scale 1080p
Cause 3: Source already compressed
- Quality can't improve beyond source
Processing Too Slow
Resizing takes too long:
Solution: Resize before other operations
# Efficient: Resize first (less data to process)
mediaproc video resize video.mp4 --scale 1080p
mediaproc video compress video_1920x1080.mp4
# Inefficient: Resize after (more data)
mediaproc video compress video.mp4
mediaproc video resize video_compressed.mp4 --scale 1080p
File Size Not Reduced
Resized video is still large:
Solution: Combine with compression
mediaproc video resize 4k.mp4 --scale 1080p
mediaproc video compress output_1920x1080.mp4 -q medium
Advanced Examples
Social Media Batch Export
#!/bin/bash
# Create versions for all social platforms
input="source.mp4"
# Instagram feed (square)
mediaproc video resize "$input" -w 1080 -h 1080 --pad -o instagram-feed.mp4
# Instagram story (vertical)
mediaproc video resize "$input" -w 1080 -h 1920 --pad -o instagram-story.mp4
# YouTube (standard)
mediaproc video resize "$input" --scale 1080p -o youtube.mp4
# Twitter (720p recommended)
mediaproc video resize "$input" --scale 720p -o twitter.mp4
# TikTok (vertical)
mediaproc video resize "$input" -w 1080 -h 1920 --pad -o tiktok.mp4
Adaptive Streaming Versions
#!/bin/bash
# Create multiple resolutions for adaptive streaming
input="source-4k.mp4"
resolutions=("1080p" "720p" "480p")
for res in "${resolutions[@]}"; do
echo "Creating $res version..."
mediaproc video resize "$input" --scale "$res" -o "stream-$res.mp4"
done
echo "All versions created:"
ls -lh stream-*.mp4
Aspect Ratio Conversion
#!/bin/bash
# Convert 16:9 to different aspect ratios
input="16x9-video.mp4"
# 4:3 (classic TV)
mediaproc video resize "$input" -w 1440 -h 1080 --pad -o 4x3.mp4
# 21:9 (ultrawide)
mediaproc video resize "$input" -w 2560 -h 1080 --pad -o 21x9.mp4
# 1:1 (square)
mediaproc video resize "$input" -w 1080 -h 1080 --pad -o 1x1.mp4
# 9:16 (vertical)
mediaproc video resize "$input" -w 1080 -h 1920 --pad -o 9x16.mp4
Progressive Downscaling
#!/bin/bash
# Progressively downscale for quality testing
input="4k-video.mp4"
current="$input"
scales=("1440p" "1080p" "720p" "480p")
for scale in "${scales[@]}"; do
output="downscaled-$scale.mp4"
echo "Downscaling to $scale..."
mediaproc video resize "$current" --scale "$scale" -o "$output"
current="$output"
done
Resolution Detection and Conditional Resize
#!/bin/bash
# Only resize if resolution exceeds threshold
input="$1"
max_width=1920
# Get current width using ffprobe
width=$(ffprobe -v error -select_streams v:0 -show_entries stream=width -of default=nv=1:nk=1 "$input")
if [ "$width" -gt "$max_width" ]; then
echo "Video width $width exceeds $max_width, resizing..."
mediaproc video resize "$input" -w "$max_width"
else
echo "Video width $width is within limits, no resize needed"
fi
Related Commands
- compress - Reduce file size after resizing
- transcode - Change format/codec during resize
- trim - Cut video before resizing to save processing time