Skip to content

Instantly share code, notes, and snippets.

@gerardovf
Created December 22, 2018 18:01
Show Gist options
  • Save gerardovf/e80d27a6669d2ea02a14bd5ed10d74e3 to your computer and use it in GitHub Desktop.
Save gerardovf/e80d27a6669d2ea02a14bd5ed10d74e3 to your computer and use it in GitHub Desktop.
How to save a RTSP Xiaofang stream using ffmpeg
#!/bin/bash
PATH_FICH=/mnt/usb/cams/xiaofang6
DATE=`date +"%Y%m%d"`
TIME=`date +"%H%M"`
mkdir -p $PATH_FICH"/"$DATE
FILE_PREFIX=$PATH_FICH"/"$DATE"/cam_fang6-"$TIME"_%04d"
# Save during 300 seconds in 60 sec. chunks
ffmpeg -rtsp_transport udp -i rtsp://192.168.0.180:554/unicast -threads 3 -vcodec copy -f segment -segment_time 60 -r 10 -t 300 $FILE_PREFIX.mp4 -y 2>/dev/null &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment