Stopping a command line VLC stream

*nix specific usage questions
pcheng
Blank Cone
Blank Cone
Posts: 11
Joined: 18 May 2006 21:42

Stopping a command line VLC stream

Postby pcheng » 19 Nov 2006 11:40

I am trying to create a program that will start a VLC stream using a file and then when the user selects it should stop the VLC stream and start a new stream using a different file.

To stop VLC I am currently using killall vlc which I think its a bad way to do it. Could you tell me if there is a command to stop the stream within my program code?

Thanks

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

Postby funman » 19 Nov 2006 13:07

if you run vlc with the telnet interface, you should be able to send it a 'quit' command

pcheng
Blank Cone
Blank Cone
Posts: 11
Joined: 18 May 2006 21:42

Postby pcheng » 20 Nov 2006 07:57

I run VLC through the program code by using: system("vlc ... &");

This allows me to run VLC and then continue running the code while the stream is being sent. How can I stop the stream after some time has passed?

In telnet i used vlc -I rc and used quit to stop it but that would be problematic in the program code.

tsr
Blank Cone
Blank Cone
Posts: 25
Joined: 24 Nov 2006 03:47

Postby tsr » 24 Nov 2006 06:06

not sure if it helps, but here's my bash script that I use to rip various streams:

Code: Select all

/usr/local/bin/mplayer -quiet -dumpstream -dumpfile ~/rip/$filename $url 2>> /dev/null >> /dev/null & echo $! >/tmp/$filename.pid sleep $length && kill `cat /tmp/$filename.pid`
this can be applied to VLC just in the same fashion.
and with a little bit of imagination you can probably see what the individual variables are for. but since this is a bash-only script, i am not sure if it helps. if you want to implement it into a C / C++ app, then it will most certainly be bad style to use bash.


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

Who is online

Users browsing this forum: No registered users and 15 guests