Periodic Snapshot of Stream

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Samwest
New Cone
New Cone
Posts: 2
Joined: 24 May 2013 02:26

Periodic Snapshot of Stream

Postby Samwest » 24 May 2013 02:51

Hi,

I was wondering if it's possible to save a periodic JPEG snapshot of an RTP stream to disk with VLC?

I have an IP security camera which I can configure to provide an MJPEG stream at 1-12fps, and I'd to end up with a folder containing a series of jpeg files taken from the stream at, say, 10 second intervals, named with a timestamp.
I don't want to just save the stream at 1fps because I need to record 24 hours a day for several years from a number of cameras, and minimising storage space while maximising snapshot quality is important.
It'd also be great if the snapshot would save the actual JPEG encoded in the MJPEG stream, rather than re-encoding the frame, as image quality is important.

An example of what I'd like to end up with:

Code: Select all

2013-05-24 17.30.00.jpg 2013-05-24 17.30.30.jpg 2013-05-24 17.31.00.jpg 2013-05-24 17.31.30.jpg ...
I can capture the raw 1fps stream ok using something like this, but at no less than 1fps, because that's as low as the camera allows the framerate to be set:

Code: Select all

vlc.exe "rtsp://111.222.333.444/live.sdp" :sout=#file{dst="%logtime% stream.mp4"}}
Secondarily, I would also settle for being able to take the camera's MJPEG stream and save it to disk at a lower framerate like 0.1fps, i.e. dropping all frames except one every 10 seconds. I'd prefer the JPEG snapshot approach though, as the video files sometimes become unplayable when saved to disk if something goes wrong during recording, and it's hard to tell if it's working correctly until after the recording is stopped, so saving snapshots every 10 seconds seems a bit more robust to stream errors and network outages etc.

Any help in the right direction here is most appreciated - I've spent a day or so trying various command line options and settings in the GUI streaming options, but haven't managed to get quite what I'm after.

Thanks in advance,
Sam.

Samwest
New Cone
New Cone
Posts: 2
Joined: 24 May 2013 02:26

Re: Periodic Snapshot of Stream

Postby Samwest » 27 May 2013 03:49

Ok, I'm getting warm. The following command takes a 10s snapshot, and does so with reasonable JPEG quality once I change the encoding quantiser (see http://blog.quindorian.org/2013/03/rtsp ... g-vlc.html for more details). I had to use trial and error to get the --scene-ratio right for a 10s snapshot though, it doesn't seem to bear any relation to the 1fps framrate of the stream.

Code: Select all

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -I dummy rtsp://111.222.333.444/live.sdp --rate 1 --video-filter=scene --vout=dummy --start-time=10 --scene-format=jpg --scene-ratio=135 --scene-prefix=snapshot --scene-path=f:\snapshots --sout-x264-lookahead=10 --sout-x264-tune=stillimage vlc://quit
This gives me files names like this:

Code: Select all

snapshot00406.jpg snapshot00271.jpg snapshot00136.jpg ...
Now my only problem is that the create files could get overwritten if there's an error and the stream restarts, or the numbering count (which seems to be related to the frame count multiplied by about 14) exceeds 99999.

I don't suppose knows an easy way of changing the file suffix naming convention??


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 117 guests