Skip to content

Instantly share code, notes, and snippets.

@Riebart
Created November 16, 2020 04:31
Show Gist options
  • Select an option

  • Save Riebart/61f56161d83a453de66cd8c3aad604ff to your computer and use it in GitHub Desktop.

Select an option

Save Riebart/61f56161d83a453de66cd8c3aad604ff to your computer and use it in GitHub Desktop.
ffmpeg incantation for side-by-siding two videos of different resolutions and framerates.
#!/bin/bash
ffmpeg \
-ss 90.75 -i "input1.mp4" \
-ss 0 -i "input2.mp4" \
-filter_complex "\
[0:v]setpts=PTS-STARTPTS,crop=iw/2:ih:iw/4:0[leftRaw];\
[1:v]setpts=PTS-STARTPTS,crop=iw/2:ih:iw/4:0[rightRaw];\
[leftRaw]scale=-1:1080[left];\
[rightRaw]scale=-1:1080[right];\
[left][right]hstack[outV];\
[0:a][1:a]amix=inputs=2[outA]" \
-map '[outV]:v' -map '[outA]:a' \
-r 45 \
-c:v hevc_nvenc -preset hq -b:v 4500k \
-c:a aac -ac 2 -b:a 192k -q:a 0 \
'out.mp4'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment