Takes 7.9 s starting one minute in, turns landscape footage on its side, and scales it into a 9:16 414×736 frame with no audio. Canvas-style loops need to be short, vertical and silent.
The command
ffmpeg -ss 60 -t 7.9 -i input.mp4 \
-vf "transpose=2,scale=414:736,fps=30" \
-an \
-map_metadata 0 \
-c:v libx264 -crf 18 -preset veryfast -pix_fmt yuv420p \
output.mp4 What each part does
-ss 60 -t 7.9 start at 1:00, keep 7.9 s (before -i = fast seek)
transpose=2 rotate 90° counter-clockwise (1 = clockwise)
scale=414:736 9:16 portrait frame
fps=30 conform to 30 fps
-an drop the audio
-map_metadata 0 keep the source's global metadata (dates, etc.)
-c:v libx264 -crf 18 -preset veryfast -pix_fmt yuv420p When to use it
Use this when you need a short, silent, vertical loop from landscape footage, such as a Spotify Canvas–style clip. It rotates the whole picture a quarter turn instead of cropping it. That suits footage shot with the camera on its side, or a deliberately sideways look. It won't cut an upright portrait out of a normal landscape scene. The header explains each flag.
Easy adaptations:
- Change
-ss 60and-t 7.9to take a different stretch of the source. - Use
transpose=1to rotate clockwise instead. - Change
fps=30or the414:736size to suit the destination.
If the picture comes out upside down from what you expected, switch between transpose=2 and transpose=1. If it comes out sideways and the source already played as portrait, ffmpeg probably auto-rotated it from a rotation flag, so the source didn't need this script. Squashed or stretched output means the source isn't 16:9, because scale forces the exact size. A short or empty file means the source runs shorter than about 1:08.
Notes
- Source
- ffmpeg-utilities/batch.sh
- Changed
- removed -metadata:s:v rotate="90". Current ffmpeg no longer sets rotation through the "rotate" tag (use -display_rotation as an input option for that), and it already auto-rotates sources that carry a rotation flag, so transpose alone yields an upright frame. fps=fps=30 → fps=30.