howto stop vlc after 30 minutes or X minutes

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
jerrygeis
Blank Cone
Blank Cone
Posts: 37
Joined: 17 Jul 2007 22:29

howto stop vlc after 30 minutes or X minutes

Postby jerrygeis » 19 Oct 2007 01:17

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

funman
Developer
Developer
Posts: 1159
Joined: 03 Sep 2006 04:03
VLC version: master
Operating System: All of them
Location: Lost, please help me

Re: howto stop vlc after 30 minutes or X minutes

Postby funman » 19 Oct 2007 12:05

you can try vlc --stop-time 1800 file.xxx vlc:quit

jerrygeis
Blank Cone
Blank Cone
Posts: 37
Joined: 17 Jul 2007 22:29

Re: howto stop vlc after 30 minutes or X minutes

Postby jerrygeis » 19 Oct 2007 17:57

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

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

Re: howto stop vlc after 30 minutes or X minutes

Postby fenrir » 21 Oct 2007 18:05

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

supernoob
New Cone
New Cone
Posts: 1
Joined: 21 May 2008 21:39

Re: howto stop vlc after 30 minutes or X minutes

Postby supernoob » 21 May 2008 23:02

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

jerrygeis
Blank Cone
Blank Cone
Posts: 37
Joined: 17 Jul 2007 22:29

Re: howto stop vlc after 30 minutes or X minutes

Postby jerrygeis » 09 Jul 2008 17:48

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

Dave S
New Cone
New Cone
Posts: 3
Joined: 31 May 2008 21:50

Re: howto stop vlc after 30 minutes or X minutes

Postby Dave S » 19 Jul 2008 04:49

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

kosic
New Cone
New Cone
Posts: 1
Joined: 06 Nov 2009 08:14

Re: howto stop vlc after 30 minutes or X minutes

Postby kosic » 06 Nov 2009 08:16

Just use option - it should work!
--run-time 20 vlc://quit

toysareforboys
New Cone
New Cone
Posts: 2
Joined: 25 Sep 2010 01:07

Re: howto stop vlc after 30 minutes or X minutes

Postby toysareforboys » 25 Sep 2010 01:53

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.

phred_pui
New Cone
New Cone
Posts: 1
Joined: 28 Nov 2012 20:19

Re: howto stop vlc after 30 minutes or X minutes

Postby phred_pui » 28 Nov 2012 20:22

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.

abondu
New Cone
New Cone
Posts: 1
Joined: 12 Dec 2012 17:04

Re: howto stop vlc after 30 minutes or X minutes

Postby abondu » 12 Dec 2012 17:36

In GNU/Linux you could use timeout:

$ timeout seconds vlc blablabla

jotess
New Cone
New Cone
Posts: 1
Joined: 24 Jan 2019 23:08

Re: howto stop vlc after 30 minutes or X minutes

Postby jotess » 24 Jan 2019 23:20

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.

ssbattousai
New Cone
New Cone
Posts: 1
Joined: 01 Feb 2020 20:04

Re: howto stop vlc after 30 minutes or X minutes

Postby ssbattousai » 01 Feb 2020 20:06

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

Andrei Iosifescu
Blank Cone
Blank Cone
Posts: 25
Joined: 24 Feb 2020 21:00

Re: howto stop vlc after 30 minutes or X minutes

Postby Andrei Iosifescu » 24 Feb 2020 21:02

You could use vbs sendkeys (hot key press Alt + F4) and Windows task Scheduler to do that.

Simano
New Cone
New Cone
Posts: 1
Joined: 04 Sep 2020 13:35

Re: howto stop vlc after 30 minutes or X minutes

Postby Simano » 04 Sep 2020 13:50

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

haydent
New Cone
New Cone
Posts: 8
Joined: 07 Jun 2018 07:33

Re: howto stop vlc after 30 minutes or X minutes

Postby haydent » 26 Mar 2022 01:11

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.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 14 guests