On 13/11/15 09:21, Mark Rogers wrote:
On 12 November 2015 at 11:56, Mark Rogers mark@more-solutions.co.uk wrote:
My thinking was that movie compression works by storing deltas between images rather than keeping each frame in full so should be "smaller".
I have done some experiments (see below) using cvlc to capture the RTSP stream from the camera.
An hour's worth of data in .ts (MPEG) video format comes in at 312MB. An hour's worth of photos (captured at a rate of 1 every 4 sec by zoneminder) comes in at 640MB.
You were right & I was wrong!
That's not necessarily a fair comparison as I don't know what frame rate the video is at (how do I find out?) but it's a good saving so far.
So, for reference, what I did was create the following script:
#!/bin/sh d=$(date +"%Y/%m/%d") f=$(date +"%Y%m%d-%H%M%S") d="/home/mark/IPCam/$d" for ip in 128 129 ; do ip=192.168.1.$ip mkdir -p $d/$ip cvlc -q --no-audio rtsp://$ip:554/11
--sout=file/ts:$d/$ip/$f.ts -I dummy --stop-time=905 vlc://quit 2>/dev/null & done
I'd by lying if I claimed to fully understand it, as it's mostly cobbled together from commandlines I found online, but the gist of it is that it captures a 905s stream (just over 15 mins) on each of two cameras (192.168.1.128 / 129) and stores it as (eg) ~/IPCam/2015/11/12/192.168.1.128/20151112-234501.ts. I run this script cron crontab every 15 mins, thus capturing video in 15min chunks.
However, reviewing the results from last night, out of 23 15 min captures from one camera, 7 have zero byte file length; from the other camera it's 5 out of 23, and there's no obvious overlap between the two cameras as to which failed to indicate a network issue.
So, does anyone have any idea what I can do to make it more robust?
Mark
My thoughts, qualified by, I've never tried this before. I'd be tempted to...
Try to get it working with just one camera first. Split it into two separate crontab jobs. If you're doing 15 minute periods, stagger by about 7 minutes. That way they're not going to be both writing to disk at the same time and thus going slow. Add some logging. e.g. echo "starting cronjob at" >>MyLogFile echo date >>MyLogFile
I think the -q flag on cvlc makes it quiet. Try it without q, or with v (verbose) instead. Instead of running it in the background, run it in the foreground. I think this will result in its output going in the system log. You're redirecting errors to /dev/null. To work out why it's not working, redirect to a/the log file.
Good luck Steve