I want get h264 streams from IP cameras, resize it, combine to grid, and restream or save to file. I succesfull split streams and save, but I don't know how can I resize streams. Becouse this streems are large, ffmpeg go to 100% cpu, loss frames and crach. Please tell me how can I resize this streams before combine and save ?? Thank for your help and time.
This is my cli
ffmpeg -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/h264" -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/h264" -filter_complex "[0:v][1:v]hstack" -c:v libx264 combo.avi
Use the scale filter with the hstack and vstack filters. Since all of your inputs are the same size you can do it like this for a 2x2 grid:
"[0:v][1:v]hstack[top];[2:v][3:v]hstack[bottom];[top][bottom]vstack,scale=iw/2:-2"
Alternatively, you could scale (and/or pad, crop, etc) each input then use the stack filters. This is useful if your inputs are not the same size:
"[0:v]scale=1024:-1[v0];[1:v]scale=1024:-1[v1];[2:v]scale=1024:-1[v2];[3:v]scale=1024:-1[v3];[v0][v1]hstack[t];[v2][v3]hstack[b];[t][b]vstack"