Below is a little Bash “wrapper” you can drop in convert.sh to take any DNxHD .mov and spit out a portrait-oriented 1080×1920 H.264 MP4. It does three things:
- Crops a centered 1080×1080 slice out of your 1902×1080 source
- Rotates it 90° (→ 1080×1080 becomes 1080×1080, but oriented vertically)
- Pads top/bottom (black bars) to reach 1080×1920
#!/usr/bin/env bash
#
# Usage: ./convert.sh in.mov out.mp4
#
if [ $# -lt 2 ]; then
echo "Usage: $0 input.mov output.mp4"
exit 1
fi
IN="$1"
OUT="$2"
ffmpeg -y -i "$IN" \
-vf "
crop=1080:1080:((iw-1080)/2):0,
transpose=2,
pad=1080:1920:0:((1920-1080)/2):black,
setsar=1
" \
-c:v libx264 -preset slow -crf 18 \
-c:a aac -b:a 128k \
-movflags +faststart \
"$OUT"
How it works
• crop=1080:1080:((iw-1080)/2):0
– take a 1080×1080 window, horizontally centred, full height.
• transpose=2
– rotate 90° CCW → now you’ve got 1080×1080 still, but vertical orientation.
• pad=1080:1920:0:((1920-1080)/2):black
– add black bars above & below to reach 1,920 pixels in height.
• setsar=1
– force square pixels.
One-liner version
If you don’t need to keep it in a script file, here’s the same as a single ffmpeg call:
ffmpeg -i in.mov \
-vf "crop=1080:1080:((iw-1080)/2):0,transpose=2,pad=1080:1920:0:420:black,setsar=1" \
-c:v libx264 -preset slow -crf 18 \
-c:a aac -b:a 128k \
-movflags +faststart \
out.mp4
(Remember that (1920-1080)/2 = 420.)
If your source is actually exactly 1920×1080 and you only want a straight 90° rotate to 1080×1920 (no cropping/padding), you can simplify to:
ffmpeg -i in.mov -vf "transpose=2,setsar=1" \
-c:v libx264 -crf 18 -preset medium \
-c:a copy out.mp4
Let me know if you hit any weird aspect-ratio flags or need further tweaks! 😊