Page 1 of 1

howto stop vlc after 30 minutes or X minutes

Posted: 19 Oct 2007 01:17
by jerrygeis
Is there a command line option to stop VLC after some time - like 30 minutes?

If I have 2 or more vlc's running how do I stop vlc-1 while still leaving vlc-2 running etc...

Thanks,

Jerry

Re: howto stop vlc after 30 minutes or X minutes

Posted: 19 Oct 2007 12:05
by funman
you can try vlc --stop-time 1800 file.xxx vlc:quit

Re: howto stop vlc after 30 minutes or X minutes

Posted: 19 Oct 2007 17:57
by jerrygeis
I did a command like:

/usr/bin/vlc --stop-time 60 http://admin:admin@192.168.1.176/img/video.asf --sout '#std{access=http,mux=asf,dst=:8080}'


to test that it would stop streaming after 60 seconds.

It does not stop.

How can I get it to stop after X minutes of streaming?

Jerry

Re: howto stop vlc after 30 minutes or X minutes

Posted: 21 Oct 2007 18:05
by fenrir
When reading a streaming source, stop-time does not always works. But you can use run-time (second) like this:
vlc url --run-time 1800 vlc:quit

Re: howto stop vlc after 30 minutes or X minutes

Posted: 21 May 2008 23:02
by supernoob
Hi,

the proposed solutions in this thread seem not to work for me. :?

The stop-time option seem to have no effect.
vlc.exe mms://62.26.161.89/ndrfernsehen$ndr_hh --sout=#duplicate{dst=display,dst=std{access=file,mux=asf,dst="D:\testkdlfljf.asf"}} --stop-time 18

When i use the run-time option the script doesnt start at all.
vlc.exe mms://62.26.161.89/ndrfernsehen$ndr_hh --sout=#duplicate{dst=display,dst=std{access=file,mux=asf,dst="D:\testkdlfljf.asf"}} --run-time 18 vlc:quit

Re: howto stop vlc after 30 minutes or X minutes

Posted: 09 Jul 2008 17:48
by jerrygeis
I am running the command:

/usr/bin/vlc --quiet http://admin:admin@192.168.1.176/img/video.asf --stop-time 60 --sout '#std{access=http,mux=asf,dst=:8080}'

trying to get VLC to stop after 60 seconds. It does not stop.


I am using slackware 0.8.5-i686 from the download pages.

I tried to add "--run-time 60" and "--run-time 60 vlc:quit" and both give the message.
vlc: unknown option or missing mandatory argument `--run-time'

Looking at the command line options on this page:
http://wiki.videolan.org/VLC_command-line_help
the --run-time is not shown.

How can I get vlc to stop after X seconds???

Thanks,

Jerry

Re: howto stop vlc after 30 minutes or X minutes

Posted: 19 Jul 2008 04:49
by Dave S
Jerry,

I have run into the same problem. I can get vlc to record an mp3 stream for one hour by using

/usr/bin/vlc --stop-time=3600 $INSTREAM ':sout=#duplicate{dst=std{access=file,mux=raw,dst="'$OUTFILE'"}}' vlc:quit

but the corresponding command to record an asf stream

/usr/bin/vlc --stop-time=3600 $INSTREAM ':sout=#duplicate{dst=std{access=file,mux=asf,dst="'$OUTFILE'"}}' vlc:quit

doesn't stop when it should (or at all). I have no idea why.

My temporary solution is to use a cron job to kill vlc when I want the recording to stop. You can use

# pgrep vlc

to determine the process number(s) of vlc, and something like

# kill -s INT $P

to stop vlc, where P is the process number. Hope this helps,

Dave

Re: howto stop vlc after 30 minutes or X minutes

Posted: 06 Nov 2009 08:16
by kosic
Just use option - it should work!
--run-time 20 vlc://quit

Re: howto stop vlc after 30 minutes or X minutes

Posted: 25 Sep 2010 01:53
by toysareforboys
I realize this is an old post, but it came up for me a few times in Google so I figured it was worth updating. I tried using:

Code: Select all

--run-time 20 vlc://quit
at the end of my command line, and indeed it would stop recording/writing after 20 seconds, but it would leave VLC open for at least a minute or two before closing it, which was unacceptable because of the timed batch files I was using. I found that using this command solved the problem, kills VLC approx 2 seconds after the timer is reached.

Code: Select all

--run-time 20 --stop-time=20 vlc://quit
The full command line I'm using in case it's helpful (On WinXP SP3, x86, VLC "GoldenEye" 1.0.5) :

Code: Select all

vlc.exe -I rc -vvv "C:\Program Files\Wowza Media Systems\Wowza Media Server 2\content\vlc.sdp" --sout=#standard{access=file,mux=ts,dst=c:\archive\today\currentstream.mp4} --run-time 3600 --stop-time=3600 vlc://quit
Basically it pulls video from my IP camera, in 1 hour chunks, and then my batch file renames the file name to a date/time stamped one, and uploads it to my FTP site where it's archived and also made available for video on demand for people to look through old video. Works sweet now, just waiting to find out what my bandwidth charges are for this month! :)

-Jamie M.

Re: howto stop vlc after 30 minutes or X minutes

Posted: 28 Nov 2012 20:22
by phred_pui
I'm using this for "parental control": It stops playing a children's movie after 30 minutes, unfortunately OS X/linux only:

Code: Select all

sleep 1500; ps x | grep VLC | grep -v grep | cut -d ' ' -f 2 | xargs kill -9
What is does:
It first sleeps for 1500 seconds, then it searches for the process VLC (that's uppercase in OS X, might be different in Linux) and then kills it.

Re: howto stop vlc after 30 minutes or X minutes

Posted: 12 Dec 2012 17:36
by abondu
In GNU/Linux you could use timeout:

$ timeout seconds vlc blablabla

Re: howto stop vlc after 30 minutes or X minutes

Posted: 24 Jan 2019 23:20
by jotess
Hello,
for me the suggested solution below (using --run-time AND --stop-time) resulted in the same problem as the first example (only --run-time) for Jamie: It stops recording, but it doesn't quit vlc.
Now I'm on Win 10 using VLC 3.0.4.

For me the solution is: only use --stop-time
So

Code: Select all

start "" vlc.exe http://swr-swr2-live.cast.addradio.de/swr/swr2/live/mp3/256/stream.mp3 --sout="#std{access=file,mux=mp3,dst=TEST.mp3}" --stop-time=10 vlc://quit
is my complete line in the batch file. (The path to vlc has been set to be contained in the windows environment variable before and the output is to be written into the folder where the bat file resides.)

A big thank you to all the users on this and other forums who enabled me to solve the puzzle bit by bit!
Now I just have to solve timed start of the recording.
... I tried using:

Code: Select all

--run-time 20 vlc://quit
at the end of my command line, and indeed it would stop recording/writing after 20 seconds, but it would leave VLC open for at least a minute or two before closing it, which was unacceptable because of the timed batch files I was using. I found that using this command solved the problem, kills VLC approx 2 seconds after the timer is reached.

Code: Select all

--run-time 20 --stop-time=20 vlc://quit
The full command line I'm using in case it's helpful (On WinXP SP3, x86, VLC "GoldenEye" 1.0.5) :

Code: Select all

vlc.exe -I rc -vvv "C:\Program Files\Wowza Media Systems\Wowza Media Server 2\content\vlc.sdp" --sout=#standard{access=file,mux=ts,dst=c:\archive\today\currentstream.mp4} --run-time 3600 --stop-time=3600 vlc://quit
...
-Jamie M.

Re: howto stop vlc after 30 minutes or X minutes

Posted: 01 Feb 2020 20:06
by ssbattousai
My wife wanted the radio to play for 2 hours then play Mozart two pianos, then repeat, I had to get the stream link from tunein like "(240) How to get Stream URL of a Radio from TuneIn [NEW] - YouTube"

Then I wrote this batch script that does the job.

@setlocal enableextensions
@cd /d "%~dp0"
@echo off
:loop
start "C:\Program Files\VideoLAN\VLC\vlc.exe" ClassicalRadio977.xspf

SET /A test=7200
timeout %test%
taskkill /F /IM vlc.exe

"C:\Program Files\VideoLAN\VLC\vlc.exe" Mozart.mp3 --play-and-exit
taskkill /F /IM vlc.exe
goto loop

Re: howto stop vlc after 30 minutes or X minutes

Posted: 24 Feb 2020 21:02
by Andrei Iosifescu
You could use vbs sendkeys (hot key press Alt + F4) and Windows task Scheduler to do that.

Re: howto stop vlc after 30 minutes or X minutes

Posted: 04 Sep 2020 13:50
by Simano
On Windows I ended killing the process by window title which is set with "--meta-title" in vlc.

Code: Select all

SET metatitle={your task title} SET source={your source} SET output={your output file} SET runtime = {needed length of recording in seconds} echo %metatitle% start "%metatitle%" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" %source% :demux=dump :demuxdump-file=%output% --meta-title=%metatitle% --input-repeat=1 --run-time=%runtime% --stop-time=%runtime% vlc://quit timeout %runtime% taskkill /FI "WindowTitle eq %metatitle%*" /T /F

Re: howto stop vlc after 30 minutes or X minutes

Posted: 26 Mar 2022 01:11
by haydent
I had a problem where for what ever reason my rtsp stream when playing the timer would never increment, so run-time or stop-time would never work.