Script for Timed Video Input Capture

*nix specific usage questions
wildrobo
New Cone
New Cone
Posts: 4
Joined: 20 Sep 2007 04:50

Script for Timed Video Input Capture

Postby wildrobo » 20 Sep 2007 04:55

Hello,
I am a windows developer new to the world of linux...using ubuntu...I have a task at hand that I need help with. I think it should be a pretty simple thing. I am using VLC to capture video from my analog camcorder. I can do it manually, but if I forget to stop, then I have like 3 hours of blank at the end of each file. I would like a script that would launch VLC, capture from the imput card, and then stop after a specified amount of time. I created a crude script that would start vlc, sleep, then close vlc. Unfortuantally, once vlc started it never got to the sleep. I imagine you may have to create a new thread or something, but then how do you send the "stop" message to it. Ideally, things like the time to capture and filename to capture to would be variables. Any help would be greatly appreciated.


This is whay I have so far.

vlc --pvr-device="/dev/video0" --pvr-radio-device="/dev/radio0" --pvr-norm=0 --pvr-frequency=-1 --pvr-bitrate=-1 --pvr-caching=300 --pvr-width=-1 --pvr-height=-1 --pvr-framerate=-1 --pvr-keyint=-1 --pvr-bframes=-1 --pvr-bitrate-peak=-1 --pvr-bitrate-mode=0 --pvr-audio-bitmask=-1 --pvr-audio-volume=-1 --pvr-channel=2 --sout file/mpg:/media/disk/MyFiles/vlcCapture.mpg --sout-display

sleep 35m

vlc stop


But all this does is launch VLC. Ifhave to hit the play button it will start the capture, but I just want to lauch the script and have it stop 35 mins after I launch it.

Thanks in advance.

wildrobo
New Cone
New Cone
Posts: 4
Joined: 20 Sep 2007 04:50

Re: Script for Timed Video Input Capture

Postby wildrobo » 18 Oct 2007 23:11

I have had no luck with this. I have searched the web and even tried to pay someone to do it. There have been alot of views for this so I assume others are interested. Here is what I have come up with, not automated but it works

I can go into VLC and open the capture device with the options I choose. Then I close out of VLC and open a treminal window. I can then enter the command
cat /dev/video0 > myfile.mpg

This captures the video to myfile.mpg. I have a pvr-150 that has a hardware encoder. I don't think you could do this with a sofware encoder. I wrote a script around this that will launch that command then sleep for a specified amount of time, then wake and kill the process.

I would still like to find an answer on how to script VLC as there are more options and I think would work for a broader audience.

fenrir
Blank Cone
Blank Cone
Posts: 45
Joined: 09 Mar 2004 21:45

Re: Script for Timed Video Input Capture

Postby fenrir » 20 Oct 2007 20:38

If you use the svn version, you can use the option --run-time (the parameter is in second). It specify the amount of time one input will run.
For example
vlc url --run-time 3600 vlc:quit
will play 'url' for 1 hour before quitting vlc.


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 3 guests