Advertisement
diggidre

record-reboot_cam1.sh

Dec 18th, 2018
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.27 KB | None | 0 0
  1. #!/bin/sh
  2. # record-reboot_e-cam1.sh
  3. # Record IPcam when it is reachable again after any case of signal lost
  4. #
  5. # This will print the current date and time in a format appropriate for storage
  6. STARTTIME=$(/bin/date +"%d.%m.%Y")-"("$(/bin/date +"%H").$(/bin/date +"%M")Uhr")"
  7. #
  8. ## IP Camera Names ##
  9. # Creating date stamps for each of the Cameras
  10. ECAM1=Cam1_$STARTTIME
  11. #
  12. ## Network and Local Storage Locations  ## #Trailing '/' is necessary here
  13. RCDIR="/home/xxx/camdata/Reboot/"
  14. #
  15. ## Record Time per File sec ##
  16. LENGTH="86400" # (24h)
  17. #
  18. ## Record Settings ##
  19. #
  20. # kill old ffmpeg process and PID file
  21. pkill -F /home/xxx/PIDs/Reboot/ffmpeg_cam1.pid
  22. sleep 1s
  23. rm -f /home/xxx/PIDs/Reboot/ffmpeg_cam1.pid
  24. # start the ping routine, check if the cam is still alive
  25. exec /home/xxx/scripts/record-ping-reconnect_cam1.sh &
  26. sleep 40s
  27. # start capture this camsource
  28. ## Record Settings ##
  29. #
  30. # -v 0    // Log level = 0
  31. # -i      // Input url
  32. # -vcidec // Set the video codec. This is an alias for "-codec:v".
  33. # -an     // Disable audio recording
  34. # -t      // Stop writing the output after its duration reaches duration
  35. #
  36. ffmpeg -v 0 -rtsp_transport tcp -i "rtsp://address:port" -vcodec copy -an -t $LENGTH $RCDIR$ECAM1.mkv & echo $! > /home/xxx/PIDs/Reboot/ffmpeg_cam1.pid
  37. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement