Skip to content

Instantly share code, notes, and snippets.

@heisvoid
Last active January 24, 2018 04:46
Example: Segmented RTSP recording for Dahua ip camera.
# My ffmpeg command makes time-based file names.
# RaspberryPi does not have RTC.
# So time should be synchronized to prevent files from being messed up.
/usr/bin/timedatectl status | /usr/bin/grep "synchronized: yes" >/dev/null 2>&1
if [ 0 -ne $? ]
then
return 1
fi
/usr/bin/ffmpeg -rtsp_transport tcp -stimeout 3000000 \
-i "rtsp://192.168.0.11/cam/realmonitor?channel=1&subtype=0&proto=Onvif" \
-r 10 -f segment -segment_time 300 -reset_timestamps 1 -c copy \
-strftime 1 "camD%Y-%m-%dT%H-%M-%S.mp4" </dev/null >/dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment