Code
- Node.js
- Python
- cURL
How the FFmpeg command works
-ss 00:00 -to 00:30— trim the video to the first 30 secondssplit=2[vid1][vid2]— duplicate the video stream so each copy can be scaled independentlyscale=...:320:...,pad=...:320:-1:-1[320p]— scale first copy to 320 px tall, letterbox to maintain aspectscale=...:180:...,pad=...:180:-1:-1[180p]— scale second copy to 180 px tall-map [320p] -map 0:a ... {{out_1}}— first output: 320p video + original audio-map [180p] -map 0:a ... {{out_2}}— second output: 180p video + original audio-c:a copy— pass audio through unchanged for both outputs-c:v libx264 -preset medium— re-encode each video with H.264
split=N and add another scale...pad...[NNp] stage plus output mapping.