videobeaux

Logo

The friendly multilateral video toolkit built for artists by artists.

View the Project on GitHub schwwaaa/videobeaux

convert_dims

Description

Converts the dimensions of a video to a chosen preset (e.g., 1080p, instagram_reels, tiktok_video) and applies a configurable aspect-ratio handling mode (pad, fit, fill, fill_crop, stretch).
Supports portrait overrides, crop/pad anchoring, custom pad color, and scaling kernel selection.

Purpose

convert_dims provides a predictable, explicit way to resize video assets into standardized resolutions for:

It gives direct control over how the aspect ratio is treated: padded, stretched, cropped, or fit.

How It Works

  1. Preset Selection
    --preset chooses a named dimension from a predefined list (e.g., 1080p, square1080, instagram_reels, portrait4k, ultrawide1440, etc.).
    Each preset maps to a fixed width/height pair.
  2. Portrait Override
    --portrait-full forces a 9:16 portrait output based on the preset’s larger side, using a full-frame cover + crop (fill_crop behavior).
  3. Mode Handling
    --mode controls aspect-ratio handling:
    • pad – keep AR, fit inside target, pad with color as needed.
    • fit – keep AR, fit inside target, no padding (may not fill entire frame).
    • fill / fill_crop – cover the frame and center-crop to the target size.
    • stretch – ignore AR, stretch directly to target dimensions.

    If --mode is not set, --translate (deprecated) chooses between:

    • yesstretch
    • nopad
  4. Anchor & Padding
    --anchor biases where crop or pad happens (center, top, bottom, left, right, top_left, etc.).
    --pad-color defines the color of any added borders.
  5. Scaling Quality
    --scale-flags selects the FFmpeg scale kernel (lanczos, bicubic, bilinear, neighbor), affecting sharpness and performance.
  6. Encoding & Output
    • Output filename is resolved to match --output-format extension.
    • Video is encoded via libx264 (yuv420p, ~5000k, medium preset) with AAC audio and +faststart for streaming-friendly MP4/MOV.

Program Template

videobeaux -P convert_dims \
  -i input.mp4 \
  -o output.mp4 \
  --output-format VALUE \
  --preset VALUE \
  --mode VALUE \
  --translate VALUE \
  --anchor VALUE \
  --pad-color VALUE \
  --scale-flags VALUE \
  --portrait-full

Arguments

Available Presets

Each preset maps to a (width, height) pair:

Real World Example

videobeaux -P convert_dims \
  -i myvideo.mp4 \
  -o convert_dims_instareel.mp4 \
  --output-format mp4 \
  --preset instagram_reels \
  --mode fill_crop \
  --anchor center \
  --pad-color "#000000" \
  --scale-flags lanczos \
  --portrait-full

Technical Notes

Quality Tips