I wrote a simple script to use vlc to record video full time. Since I want to have the video in 1 hour pieces I use cron to restart the recording every hour. It also can delete the old files. The rtsp stream path is for a Dahua HFW4300S, but can be replaced for the path of other cameras.
# create filename including date and hour
RECORDFILE=$(date +"%Y-%m-%d-%H")
RECORDFILE="cameraname-$RECORDFILE.mp4"
# save stream for 3599 secords to DIRECTORY which could be /home/user/Videos
cvlc 'rtsp://user:pwd@IPadd:554/cam/realmonitor?channel=1&subtype=0' --sout file/mp4:/DIRECTORY/$RECORDFILE --run-time=3599 vlc://quit
# delete files 15 days old
find /DIRECTORY/ -name "*.mp4" -type f -ctime +15 -delete
This does not decompress or transcode the stream so it records without using much cpu. I am using zoneminder modect on the low definition substream to locate the important events.
Full time video recording with vlc
-
- Posts: 38
- Joined: Wed Jul 23, 2014 12:21 am
Re: Full time video recording with vlc
I know it's been a while, but thanks for posting this. Do you still run your setup this way? I have Hikvision and D-Link cameras and am doing using secondary streams for motion detection also, albeit at 6fps. Saving the raw stream lets me capture 1080p @ 25fps using only 1% CPU. Only hitch is that VLC complains about the initial frame exceeding the buffer size, but it still works nice.
Sure would be nice if ZoneMinder could record video on events this way. These issues on GitHub are relevant:
https://github.com/ZoneMinder/ZoneMinder/issues/39
https://github.com/ZoneMinder/ZoneMinder/issues/452
Sure would be nice if ZoneMinder could record video on events this way. These issues on GitHub are relevant:
https://github.com/ZoneMinder/ZoneMinder/issues/39
https://github.com/ZoneMinder/ZoneMinder/issues/452