Skip to content

Instantly share code, notes, and snippets.

@shivanshtalwar0
Created July 6, 2024 23:20
Show Gist options
  • Save shivanshtalwar0/fe2f1467be49a3a9031bfb20f3b88479 to your computer and use it in GitHub Desktop.
Save shivanshtalwar0/fe2f1467be49a3a9031bfb20f3b88479 to your computer and use it in GitHub Desktop.
ffmpeg grid for 4 videos on cuda device
ffmpeg -y -hwaccel cuda \
-i video1.mp4 -hwaccel cuda -i video2.mp4 -hwaccel cuda -i video3.mp4 -hwaccel cuda -i video4.mp4 \
-filter_complex "[0:v]scale=iw/2:ih/2[v0];[1:v]scale=iw/2:ih/2[v1];[2:v]scale=iw/2:ih/2[v2];[3:v]scale=iw/2:ih/2[v3];[v0][v1]hstack[top];[v2][v3]hstack[bottom];[top][bottom]vstack" \
-c:v h264_nvenc -preset fast -b:v 5M output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment