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.