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
Info

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

Terminal
$ mediaproc video resize <input> [options]

Options

Basic Options

OptionAliasTypeDefaultDescription
--output-ostringAutoOutput file or directory path
--scale-sstring1080pResolution: 360p, 480p, 720p, 1080p, 1440p, 2160p (4K), 4320p (8K), or WxH
--verbose-vbooleanfalseShow detailed FFmpeg output
--dry-runbooleanfalsePreview command without executing

Video Codec & Quality

OptionAliasTypeDefaultDescription
--codec-cstringh264Video codec: h264, h265, vp9, av1
--quality-qnumber23CRF quality: 0-51, lower is better quality
--presetstringmediumEncoding preset: ultrafast, fast, medium, slow, veryslow
--bitrate-bstringTarget bitrate (e.g., 5M for 5 Mbps, 10M for 10 Mbps)
--two-passbooleanfalseUse two-pass encoding for optimal quality distribution

Resolution & Aspect Ratio

OptionAliasTypeDefaultDescription
--aspect-astringForce aspect ratio: 16:9, 4:3, 21:9, 1:1
--fpsnumberOutput frame rate (e.g., 24, 30, 60)
--scale-algostringlanczosScaling algorithm: bilinear, bicubic, lanczos, spline

Transformation

OptionAliasTypeDefaultDescription
--rotatenumberRotate video: 90, 180, 270 degrees
--flipstringFlip video: horizontal, vertical, both
--cropstringCrop video (width:height:x:y or preset: 16:9, 4:3, 1:1)
--deinterlacebooleanfalseDeinterlace video (for interlaced sources like old DVDs)

Performance & Output

OptionAliasTypeDefaultDescription
--formatstringOutput format: mp4, mkv, webm, avi
--threadsnumberautoNumber of CPU threads for encoding (default: auto-detect)
--hw-accelbooleanfalseEnable hardware acceleration (GPU encoding, 5-10x faster)
--no-audiobooleanfalseRemove 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) ← default
  • 1440p = 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
Warning

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 files
  • superfast - 5x faster, +15-20% larger files
  • veryfast - 3x faster, +10-15% larger files
  • faster - 2x faster, +5-10% larger files
  • fast - 1.5x faster, +5% larger files
  • medium - Balanced speed/quality ← default
  • slow - 1.5x slower, 5-10% smaller files, better quality
  • slower - 2x slower, 10-15% smaller files, better quality
  • veryslow - 3x+ slower, 15-20% smaller files, best quality

Recommendations:

  • Quick tests: fast or faster
  • Production: slow or veryslow
  • Live streaming: ultrafast or veryfast
  • 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 Mbps
  • 10M = 10 Mbps

Recommended Bitrates by Resolution:

ResolutionH.264 BitrateH.265 BitrateUse Case
360p0.5-1 Mbps0.3-0.7 MbpsMobile 3G
480p1-2 Mbps0.7-1.5 MbpsMobile 4G
720p2.5-5 Mbps1.5-3 MbpsHD streaming
1080p5-8 Mbps3-5 MbpsFull HD
1440p10-15 Mbps6-10 MbpsQHD
4K (2160p)20-40 Mbps15-25 MbpsUltra HD
Info

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 content
  • 21:9 - Ultrawide cinema
  • 1: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 look
  • 25 - PAL video standard
  • 30 - NTSC video standard, most web content
  • 60 - High frame rate, smooth motion, gaming
  • 120 - 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/right
  • vertical - Mirror top/bottom
  • both - Both axes (equivalent to 180° rotation + horizontal flip)

--crop - Cropping

Remove portions of the video frame.

Format Options:

Preset Ratios:

  • 16:9 - Widescreen crop
  • 4:3 - Classic crop
  • 1:1 - Square crop (centered)

Custom Crop:

  • Format: width:height:x:y
  • width - Crop width in pixels
  • height - Crop height in pixels
  • x - X offset from left
  • y - 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:

  1. First Pass: Analyzes entire video, collects statistics
  2. 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

PresetResolutionAspect RatioCommon Use
360p640x36016:9Very low bandwidth, preview
480p854x48016:9Mobile, low bandwidth
720p1280x72016:9HD, web streaming
1080p1920x108016:9Full HD, standard distribution
1440p2560x144016:9QHD, gaming, high-end displays
2160p3840x216016:94K/UHD, premium content
4320p7680x432016:98K/UHD, cinema-grade

Examples

Basic Resizing

Terminal
$ mediaproc video resize 4k-video.mp4 --scale 1080p
Input: 4k-video.mp4 • Resolution: 3840x2160
Duration: 00:03:45
Resizing to 1920x1080...
✓ Resize complete
Output: 4k-video_1920x1080.mp4 • Size: 180.5 MB
Terminal
$ mediaproc video resize video.mp4 -s 720p
✓ Resized to 1280x720
Terminal
$ mediaproc video resize video.mp4 -s 4K -c h265
✓ Resized to 4K with HEVC codec

Folder Support

Terminal
$ mediaproc video resize videos/ -s 1080p -o output/
Processing 5 videos...
✓ video1.mp4 → 1920x1080
✓ video2.mp4 → 1920x1080
✓ All videos processed

Advanced Codec Options

Terminal
$ mediaproc video resize video.mp4 -s 2160p -c h265 --preset slow
✓ Resized to 4K using HEVC with high quality
Terminal
$ mediaproc video resize video.mp4 -s 1080p -c av1 --two-pass
✓ Resized with AV1 codec (two-pass encoding)

Custom Aspect Ratio

Terminal
$ mediaproc video resize video.mp4 -s 1920x1080 -a 16:9
✓ Resized to Full HD with 16:9 aspect ratio
Terminal
$ mediaproc video resize video.mp4 -s 1080x1080 -a 1:1
✓ Square format for Instagram

Frame Rate Control

Terminal
$ mediaproc video resize video.mp4 -s 1080p --fps 60
✓ Resized to 1080p at 60fps
Terminal
$ mediaproc video resize video.mp4 -s 720p --fps 24
✓ Cinematic 24fps output

Rotation and Flip

Terminal
$ mediaproc video resize video.mp4 -s 1080p --rotate 90
✓ Resized and rotated 90 degrees
Terminal
$ mediaproc video resize video.mp4 -s 720p --flip horizontal
✓ Resized with horizontal flip

Cropping

Terminal
$ mediaproc video resize video.mp4 -s 1080p --crop 16:9
✓ Resized and cropped to 16:9
Terminal
$ mediaproc video resize video.mp4 -s 1080p --crop 1920:1080:0:0
✓ Custom crop applied

Hardware Acceleration

Terminal
$ mediaproc video resize 8k-video.mp4 -s 2160p --hw-accel
✓ GPU-accelerated resize complete (10x faster)

Bitrate Control

Terminal
$ mediaproc video resize video.mp4 -s 1080p -b 10M
✓ Resized with 10 Mbps bitrate
Terminal
$ mediaproc video resize video.mp4 -s 2160p -b 15M --fps 60
✓ 4K 60fps with 15 Mbps

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

  1. Downscale only: Upscaling reduces quality
  2. Use presets: Easier than custom dimensions
  3. Test with --dry-run: Preview before processing
  4. Combine with compress: Further reduce file size after resizing
  5. Keep originals: Never resize source files
  6. Match aspect ratio: Avoid distortion
  7. Use padding for social: Exact dimensions with --pad
  8. 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
  • compress - Reduce file size after resizing
  • transcode - Change format/codec during resize
  • trim - Cut video before resizing to save processing time

See Also

Found an issue? Help us improve this page.

Edit on GitHub →