CodeNewbie Community

Cover image for How to replicate the output of the FullScreen template from StreamLadder
Donald Feury
Donald Feury

Posted on • Originally published at donaldfeury.xyz on

How to replicate the output of the FullScreen template from StreamLadder

How to replicate the output of the FullScreen template from StreamLadder

StreamLadder is a nifty little tool for creating vertical versions of your Twitch clips for platforms like Tiktok and YouTube Shorts. However, I like tinkering with FFmpeg so I replicated the output with a simple command.

If we look at the Fullscreen template, all it's essentially doing is cropping the original clip down into a 9:16 ratio.

To do the same with FFmpeg we can just do the following:

#!/usr/bin/env sh

# the source video (in this case, a twitch clip)
input=$1

# where you want to save the processed version
output=$2

ffmpeg \
    -i "$input" \
    -vf "crop=w=in_h*9/16:h=in_h,scale=1080x1920" \
    -vcodec libx264 \
    -crf 23 \
    -preset veryfast \
    -c:a copy \
    -s 1080x1920 \
    "$output"

Enter fullscreen mode Exit fullscreen mode

The main part of this command doing all the work is the video filter, denoted with -vf. We do w=in_h*9/16 to set the width of the video to the 9:16 ratio compared to what the height of the video is while we keep the height the same with h=in_h. We finally scale the video up to 1080x1920 with the scale filter.

If the video quality looks a bit pixelated from scaling up too much, anywhere you see 1080x1920 replace with a smaller equivalent like 720x1280

Discussion (0)