VLC Timer?

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
CheeseKing
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Jul 2009 09:07

VLC Timer?

Postby CheeseKing » 02 Jan 2010 18:50

I have a bit of a predicament which I'm hoping one of you fine folks can help with. You see, I use VLC to play an endless loop of a certain sound file to help me get to sleep at night. Thing is, it keeps playing long after I've gotten to sleep. I'd like to set a timer if possible to make VLC shut down, or perhaps simply stop playing after a set amount of time. Say, an hour or so. Is there any way to do this?

CheeseKing
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Jul 2009 09:07

Re: VLC Timer?

Postby CheeseKing » 16 Jan 2010 03:39

<------------->
Last edited by CheeseKing on 24 Jan 2010 22:08, edited 1 time in total.

Arite
Big Cone-huna
Big Cone-huna
Posts: 2478
Joined: 26 Jun 2007 20:40
VLC version: 3.0.20
Operating System: Debian Testing|Win10

Re: VLC Timer?

Postby Arite » 22 Jan 2010 14:48

You can use the --input-repeat commandline option.

For example, running the command:

Code: Select all

vlc.exe --input-repeat 9 C:\Temp\File.mp3 vlc://quit
Will play the file "C:\Temp\File.mp3" 10 times (i.e. repeated 9 times). After that VLC will close (what vlc://quit does).

If you wanted to shutdown you PC you could write a Batch script with a shutdown command after the VLC one. For example:

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" --input-repeat 9 C:\Temp\File.mp3 vlc://quit shutdown -s -t 0
Where "C:\Program Files\VideoLAN\VLC" is the location of VLC.

That should play the file 10 times in VLC, close VLC and then shutdown your computer. You can just write something like into e.g. Notepad, and then save it as a *.bat file (e.g. "night-music.bat"). Then just double click it to run the script.

Cheers, Arite.
Don't use PMs for support questions.

CheeseKing
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Jul 2009 09:07

Re: VLC Timer?

Postby CheeseKing » 22 Jan 2010 22:21

Nice! I'll give the first one a shot, thanks. Unfortunately, I can't turn my computer off as I have hardware/software that will only work if it's on.

CheeseKing
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Jul 2009 09:07

Re: VLC Timer?

Postby CheeseKing » 22 Jan 2010 22:41

Hey, it worked! Thanks! Is there any command line option I could use to set the volume to a certain level as well?

Edit: I did some Googling and found out that --volume is the correct command. What I find odd, however, is that the number you enter into the command line corresponds strangely with the percentage of volume that VLC starts out with. See, here's my command line:

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --input-repeat 60 --volume 194 C:\BabblingBrook.wav vlc://quit

I had to keep experimenting with the number I put after --volume to get it to set VLCs volume to 75%, as 75% was the volume percentage I wanted VLC to start out with when playing this batch file. I would have thought I could just put 75 after --volume and it would set the volume to 75%, but that was not the case. I'm still unsure as to why setting it to 194 would result in 75%, but it works, so who am I to complain. Perhaps someone could enlighten me about how the --volume command works.

Arite
Big Cone-huna
Big Cone-huna
Posts: 2478
Joined: 26 Jun 2007 20:40
VLC version: 3.0.20
Operating System: Debian Testing|Win10

Re: VLC Timer?

Postby Arite » 23 Jan 2010 04:16

Hey, it worked! Thanks!
Nice, glad it worked.
I had to keep experimenting with the number I put after --volume to get it to set VLCs volume to 75%, as 75% was the volume percentage I wanted VLC to start out with when playing this batch file. I would have thought I could just put 75 after --volume and it would set the volume to 75%, but that was not the case. I'm still unsure as to why setting it to 194 would result in 75%, but it works, so who am I to complain. Perhaps someone could enlighten me about how the --volume command works.
The reason 194 works is because the range of VLC's volume is from 0 to 1024. 1024 corresponds to 400%, hence 100% is 256. Therefore 192 is 75% (as 256*0.75 = 192).

Cheers, Arite.
Don't use PMs for support questions.

CheeseKing
Blank Cone
Blank Cone
Posts: 10
Joined: 24 Jul 2009 09:07

Re: VLC Timer?

Postby CheeseKing » 23 Jan 2010 05:30

Well now, that makes sense now that it's been explained. Thanks again for the command line tip. I owe ya one. :)

taurusx5
Blank Cone
Blank Cone
Posts: 32
Joined: 20 Sep 2008 18:55

Re: VLC Timer?

Postby taurusx5 » 26 Mar 2010 02:27

If you wanted to shutdown you PC you could write a Batch script with a shutdown command after the VLC one. For example:

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" --input-repeat 9 C:\Temp\File.mp3 vlc://quit shutdown -s -t 0
Where "C:\Program Files\VideoLAN\VLC" is the location of VLC.

That should play the file 10 times in VLC, close VLC and then shutdown your computer. You can just write something like into e.g. Notepad, and then save it as a *.bat file (e.g. "night-music.bat"). Then just double click it to run the script.

Cheers, Arite.
Hi, Arite. I got a question about the command line you suggested to shut down the PC after VLC stops playing a file. Let's say that I run your script. But after say a month, I want my PC to return to normal. What script do I run to make my PC not shut down after playing a file in VLC?

.

Arite
Big Cone-huna
Big Cone-huna
Posts: 2478
Joined: 26 Jun 2007 20:40
VLC version: 3.0.20
Operating System: Debian Testing|Win10

Re: VLC Timer?

Postby Arite » 26 Mar 2010 16:45

The line which shuts down the PC is:

Code: Select all

shutdown -s -t 0
So if you don't want to shut down you PC just run the first line:

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" --input-repeat 9 C:\Temp\File.mp3 vlc://quit
^ That will still close VLC after playing the file (remove vlc://quit if you don't want to close VLC).

Arite.
Don't use PMs for support questions.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: Bing [Bot] and 16 guests