Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Run VLC as background through Applescript, and more

Qualifiers:

VLC version 0.9.10

OSX 10.4.11

Applescript 2.1


I am trying to set up an Applescript to run VLC in stream capture mode in the background. I can get it to work with:


do shell script "[path to bundle in VLC app] [stream URL] --sout=file/raw:[path to saved file].raw &> /dev/null 2>&1& echo $!"


This opens up a VLC application window, captures, and all is fine. Before I routed all the output at the end of the command it would capture the stream but the script would remain frozen until I quit the VLC application, hence the stuff at the end. My script needs to keep running actively because it includes a component to periodically check the capture is still taking place (my Internet connection can be dodgy with wi-fi interference from neighbors) by monitoring the modification date of the capture file, so I have to route the output to null so the script doesn't hang. I tried running it with just the background & and it still hung. Oh, I am capturing the PID so I can include a kill command to stop the process later.


I tried doing something similar with


do script with command etc. -- (modification of end of command line so it finishes after ".raw")


in Terminal and it worked too, though it opened up a couple of Terminal windows which had to stay open all the time and when I wanted to stop the capture I had to close the VLC Terminal window.


Now the real issue. I want to have a second copy of VLC running for other use while the first is doing things quietly. I know it can be done. Before writing my Applescript I used to have one copy of VLC in GUI mode capturing a stream and a second copy of the app in GUI for playing other media, both running happily side by side. It also worked when I ran it from an Applescript with the first VLC channeling through Terminal output. Now when I have the first copy running via Applescript I can open the second copy but when I try to play a file VLC just plays the whole thing back in a few seconds with no output. It seems the output channeling from the first command line invocation of VLC is also influencing the second application (?? !) Although I have renamed the application I didn't start messing with things in the app package itself so maybe I also need to change some identifiers in plist settings or bundle names so it really is accepted as a completely different app?


I know this is a mix of archaic OSX technologies, both Unix and Applescript, and maybe something non-Apple and VLC-specific but I spent an hour or two doing web searches for tips, and a lot of experimentation with various combinations myself and didn't get far. I am not sure if I have explored all the possibilities with the shell command, or if I can do something to change my second VLC application so it truly stands alone, or this just won't work, or...?


Oh, just in case somebody suggests it, using an "open" in a shell script does not have a -n flag under Tiger OS, so I can't start a new instance of the old VLC that way (and it may suffer the same problem).

G4 Quicksilver 2x1GHz 250/120GB HDs-OTHER, Mac OS X (10.4.11), OS9.2.2, iTunes7.5, QT7.4&QTP2.5.1

Posted on Apr 24, 2015 12:44 PM

Reply
1 reply

Apr 27, 2015 11:00 PM in response to Limnos

I discovered that even when I quit my script and tried running VLC normally after that it still wasn't playing things normally although repeated runs of the script go things running in the background fine. I trashed VLC's preferences and things played normally. I really wish I know how to get a second copy of VLC to run in complete isolation of the first, including separate preferences, since it is a nuisance to have to trash preferences to switch between uses of VLC.

Run VLC as background through Applescript, and more

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.