Stream Loop overwrites output file

Discussion about configuration and usage of VLM (a stream scheduler) within VLC.
ivanxx
New Cone
New Cone
Posts: 2
Joined: 25 Apr 2011 21:20

Stream Loop overwrites output file

Postby ivanxx » 25 Apr 2011 21:35

Hi guys,

I've set up a small surveilance recorder using vlm and vlc running in telnet mode so I can rotate the output files from a cron file using a expect script. I rotate the output stream files once a day, and start over every new week.

It works great, but I just discovered that in case power fails in my camera, the file being recorded gets overwritten when the camera is back online and the stream resumes.

Is there any way to force the file to be appended to the existing output instead of overwritten?

Thanks for being there!

Ivan.

yasdnil1
New Cone
New Cone
Posts: 9
Joined: 13 May 2011 22:55

Re: Stream Loop overwrites output file

Postby yasdnil1 » 09 Jun 2011 22:39

Ooh, could you explain what you did to set this up? I don't get the 'rotate the output files from a cron file using an expect script', what's that mean? How'd you do that?

ivanxx
New Cone
New Cone
Posts: 2
Joined: 25 Apr 2011 21:20

Re: Stream Loop overwrites output file

Postby ivanxx » 15 Jun 2011 17:50

sure!, I just configured a vlc running in telnet mode. This means you can actually telnet to your host on the port you specified on the vlc start command and send control commands to the vlc.
On the other hand you have expect, a scriptable telnet interface that allows you to telnet to a host, wait for prompts and send responses. In this case, my expect script contains the necessary commands to stop the running vlc stream, change the name for the output file based on the weekday, and restart the streaming recording. I run this expect script everyday at 0:00 from the crontab, so I have a new file everyday that overwrites last week's.

Here's my actual expect script:

#!/usr/bin/expect -f
set systemTime [clock seconds]
set dia [clock format $systemTime -format %A]
set timeout -1
spawn telnet localhost 4212
match_max 100000
expect -exact "Trying 127.0.0.1...\r
Connected to localhost.\r
Escape character is '^\]'.\r
VLC media player 1.1.9 The Luggage\r
Password: "
send -- "mypassword\r"
expect -exact "\r
Welcome, Master\r
> "
send -- "control cam1 stop"
expect -exact "control cam1 stop"
send -- "\r"
expect "> "
send -- "setup cam1 output #std{access=file,mux=ts,dst=/path_to_storage/$dia.mp4}"
expect -exact "setup cam1 output #std{access=file,mux=ts,dst=/path_to_storage/$dia.mp4}"
send -- "\r"
expect -exact "\r
setup\r
> "
send -- "control cam1 play"
expect -exact "control cam1 play"
send -- "\r"
expect -exact "\r
control\r
> "
send -- "quit\r"
expect eof

You need to have vlc running and listening on the telnet port before you run this, and the cam1 stream configured against your camera, but I assume you can find the information required for this in the vlc docs.

happy expectin'!

Ivan.

yasdnil1
New Cone
New Cone
Posts: 9
Joined: 13 May 2011 22:55

Re: Stream Loop overwrites output file

Postby yasdnil1 » 21 Jun 2011 15:56

Hmmm, still confusing :( I so don't get VLM stuff. Think I need a more bare bones explanation. Haha. If only you could youtube it or sumthin. Thx for the info, though.
I dunno if this helps or anything, but I found this --sout-file-append command and other append commands in this doc. Dunno if that's what you need, but here's the web addy:
http://wiki.videolan.org/VLC_command-line_help


Return to “VLM”

Who is online

Users browsing this forum: No registered users and 0 guests