7.1 KiB
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:
- social platforms (Reels, Shorts, TikTok, Stories),
- broadcast or web delivery,
- square or portrait exports,
- ultrawide and cinema formats,
- archival normalization.
It gives direct control over how the aspect ratio is treated: padded, stretched, cropped, or fit.
How It Works
-
Preset Selection
--presetchooses 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. -
Portrait Override
--portrait-fullforces a 9:16 portrait output based on the preset’s larger side, using a full-frame cover + crop (fill_crop behavior). -
Mode Handling
--modecontrols 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
--modeis not set,--translate(deprecated) chooses between:yes→stretchno→pad
-
Anchor & Padding
--anchorbiases where crop or pad happens (center,top,bottom,left,right,top_left, etc.).
--pad-colordefines the color of any added borders. -
Scaling Quality
--scale-flagsselects the FFmpeg scale kernel (lanczos,bicubic,bilinear,neighbor), affecting sharpness and performance. -
Encoding & Output
- Output filename is resolved to match
--output-formatextension. - Video is encoded via libx264 (
yuv420p, ~5000k,mediumpreset) with AAC audio and+faststartfor streaming-friendly MP4/MOV.
- Output filename is resolved to match
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
- output-format — Required. Output file format/extension (e.g.,
mp4,mov). If the-opath has a different suffix, it is replaced with this. - preset — Required. Named dimension preset (e.g.,
1080p,square1080,instagram_reels,tiktok_video,ultrawide1440, etc.). Each maps to a specific width/height. - mode — Aspect-ratio handling mode:
pad– maintain AR, fit inside target, pad with color.fit– maintain AR, fit inside target, no padding.fill,fill_crop– cover target and center-crop based onanchor.stretch– ignore AR and stretch to the exact width/height.
- translate — Deprecated compatibility flag. When
--modeis not set:yes→ behaves likestretch.no→ behaves likepad.
- anchor — Crop/pad bias position:
center,top,bottom,left,right,top_left,top_right,bottom_left,bottom_right.
Affects where the image sits when padding or cropping.
- pad-color — Hex color for padding borders in
padmode (e.g.,#000000,#FFFFFF). - scale-flags — Scaling kernel:
lanczos,bicubic,bilinear, orneighbor. Controls quality vs speed. - portrait-full — When present, forces a 9:16 full-frame portrait output using the preset’s larger dimension as height and a derived width, then uses a cover + crop mode (effectively
fill_crop).
Available Presets
Each preset maps to a (width, height) pair:
sd– 320×240720hd– 640×3601080hd– 960×540widescreen– 320×180portrait1080– 1080×1620480p– 640×480576p– 720×576720p– 1280×7201080p– 1920×10801440p– 2560×14404k– 3840×21608k– 7680×4320vga– 640×480qvga– 320×240wvga– 800×480svga– 800×600xga– 1024×768wxga– 1280×800sxga– 1280×1024uxga– 1600×1200wuxga– 1920×1200qwxga– 2048×1152qhd– 2560×1440wqxga– 2560×16005k– 5120×2880portrait720– 720×1280portrait4k– 2160×3840square1080– 1080×1080square720– 720×720cinema4k– 4096×2160ultrawide1080– 2560×1080ultrawide1440– 3440×1440instagram_feed– 1080×1080instagram_reels– 1080×1920instagram_stories– 1080×1920tiktok_video– 1080×1920youtube_standard– 1920×1080youtube_shorts– 1080×1920facebook_feed– 1080×1080facebook_stories– 1080×1920twitter_video– 1280×720twitter_square– 1080×1080linkedin_video– 1920×1080linkedin_square– 1080×1080snapchat_video– 1080×1920pinterest_video– 1080×1920pinterest_square– 1000×1000
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
- Dimensions are always adjusted to even values to remain codec-safe.
portrait-fulleffectively overridesmodeto a full-frame, cover-style portrait crop while honoring the preset’s size.scale-flags=lanczosoffers high-quality resizing at the cost of some speed.- FFmpeg is called with:
-c:v libx264,-b:v 5000k,-pix_fmt yuv420p,-preset medium-c:a aac,-b:a 160k,-ar 48000,-movflags +faststart
--force(global Videobeaux argument) controls overwrite; if not set, existing files cause an error.
Recommended Usage
- Generating social-media-optimized versions (Reels, Shorts, Stories, TikTok).
- Converting to square or portrait outputs while controlling crop bias via
anchor. - Quickly standardizing deliverables to 1080p, 4K, or other common presets.
- Converting landscape footage into vertical 9:16 promo clips using
--portrait-full.
Quality Tips
- Use
mode=padwith a neutralpad-colorwhen you want to preserve entire frames without cropping. - Use
mode=fill_cropfor platform-native aspect ratios where filling the frame is more important than preserving the entire source frame. - Set
anchor=toporanchor=bottomfor content where the action is biased toward one edge (e.g., heads near the top). - Keep
scale-flags=lanczosfor master/delivery renders; drop tobicubicorbilinearfor faster, iterative tests. - Always verify the final AR and framing visually after using
stretchto avoid unwanted distortion.