Advertisement
metalx1000

Thingino Camera Grid

Jun 19th, 2025 (edited)
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.57 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2025 Kris Occhipinti
  4. #https://filmsbykris.com
  5. #This program is free software: you can redistribute it and/or modify
  6. #it under the terms of the GNU General Public License as published by
  7. #the Free Software Foundation version 3 of the License.
  8.  
  9. #This program is distributed in the hope that it will be useful,
  10. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. #GNU General Public License for more details.
  13.  
  14. #You should have received a copy of the GNU General Public License
  15. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. ######################################################################
  17.  
  18. # Stream a grid of videos from cameras
  19.  
  20. #channel 1 is a lower resolution on thingino over channel 0
  21. # this is better for streaming multiple cameras
  22. cam_01="rtsp://thingino:thingino@camera-01:554/ch1"
  23. cam_02="rtsp://thingino:thingino@camera-02:554/ch1"
  24. cam_03="rtsp://thingino:thingino@camera-03:554/ch1"
  25.  
  26. # I only have 3 cameras so create black video to fill last spot
  27. # Create a black video source
  28. black="color=c=black:s=640x360" # adjust resolution to match other videos
  29.  
  30. top_row="[0:v][1:v]hstack=inputs=2[top];"
  31. bottom_row="[2:v][3:v]hstack=inputs=2[bottom];"
  32.  
  33. stack="[top][bottom]vstack=inputs=2[v]"
  34.  
  35. ffmpeg -i "$cam_01" -i "$cam_02" -i "$cam_03" -f lavfi -i "$black" \
  36.   -filter_complex "${top_row}${bottom_row}${stack}" \
  37.   -map "[v]" -c:v libx264 -f nut - | ffplay -i -
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement