Computer SoftwareVideo Softwareffmpeg FFMPEG Show multiple RTSP videos in grid Updated November 05 2025
This is untested but looks like it would work:
https://stackoverflow.com/questions/66983033/ffmpeg-2x2-grid-cameras-stream-to-youtube

ffmpeg -rtsp_transport tcp -i "input1" -rtsp_transport tcp -i "input2" -rtsp_transport tcp -i "input3" -rtsp_transport tcp -i "input4" -filter_complex "[0:v] setpts=PTS-STARTPTS, scale=960x540 [a0];[1:v] setpts=PTS-STARTPTS, scale=960x540 [a1];[2:v] setpts=PTS-STARTPTS, scale=960x540 [a2];[3:v] setpts=PTS-STARTPTS, scale=960x540 [a3];[a0][a1][a2][a3]xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0,format=yuv420p[out]" -map "[out]" -map 3:a -c:v libx264 -preset medium -tune zerolatency -b:v 5000k -maxrate 5000k -bufsize 10000k -r 15 -c:a aac -ac 2 -f flv rtmp://a.rtmp.youtube.com/live2/

Removed -video_size 1920x1080 as this is being ignored because it is generally an input option for certain demuxers.
Removed -q:v 3 because libx264 ignores -q:v. Use -crf or -b:v instead.
Removed -crf 15 because it is mutually exclusive with -b:v. This means you can only use one at a time. If you use both then one will get ignored. For streaming you should use -b:v instead of -crf unless you know what you're doing.
Removed -level 3.0. Level 3.0 is too low for 1920x1080 (libx264 will tell you this in the log output with a "level limit" warning). You shouldn't need to limit the level anyway.
Removed -profile:v baseline. No need to target devices from 2008.
Added format filter format=yuv420p so the output is always YUV 4:2:0 for chroma subsampling.
Added -bufsize and -maxrate to enable VBV which is highly recommended for streaming.
Search Keywords: RSTP




©2024 - Some portions of this website are Copyrighted.
Your IP: 216.73.216.2     Referring URL:
Browser: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Terms and Conditions, Privacy Policy, and Security Policy