How to open MRL with options using AppleScript?

macOS specific usage questions
oihewrjdf
New Cone
New Cone
Posts: 2
Joined: 01 Mar 2012 00:15

How to open MRL with options using AppleScript?

Postby oihewrjdf » 01 Mar 2012 00:40

Hello,

I want to write an AppleScript that will record a web radio stream into a file.
I don't want to enter all the options through the Streaming/Transcoding Wizard each time I want to record.

It is easy to go through terminal and start recording in VLC with this code:

Code: Select all

/Applications/VLC.app/Contents/MacOS/VLC -q http://174.123.20.131:8050/ --sout '#duplicate{dst=display,dst="transcode{acodec=s16l,ab=192}:standard{mux=wav,dst=/Users/myname/Desktop/bp.wav,access=file}"}'
and we can "tell application terminal" to do this through an AppleScript.

The Problem (for me) with this method is, that terminal stays open and "hung up" in this process, until I quit VLC, and that I also have to manually quit terminal. I have a hundred windows open, when I work, and I don't want to add to the clutter. Also, I do use terminal for other things, and don't want that window in my face.

So I'm trying to do it all from AppleScript to VLC directly.

This works beautifully, of course:

Code: Select all

tell application "VLC" OpenURL http://174.123.20.131:8050/ play next end tell
but how do I add the options to the MRL?! I cannot save them in a playlist, because VLC is set to not regard EXTVLCOPT in playlists for security reasons, so this option is out.

The format of the MRL is given as

Code: Select all

[[access][/demux]://]URL[@[title][:chapter][-[title][:chapter]]] [:option=value ...]
so it seems that it should be possible to add the :options to the URL, but this does not work (or at least I could not make it work).

So how can I modify that basic AppleScript to tell VLC that I need it to transcode the stream? This are the options, copied from the last window of the Streaming/Transcoding Wizard:

Code: Select all

:sout=#duplicate{dst=display,dst="transcode{acodec=s16l,ab=192}:standard{mux=wav,dst=/Users/myname/Desktop/bp.wav,access=file}"}
What do I write into my AppleScript, so that VLC knows about these options?

Any help is greatly appreciated.

kemuel
New Cone
New Cone
Posts: 3
Joined: 01 Mar 2012 00:58

Re: How to open MRL with options using AppleScript?

Postby kemuel » 01 Mar 2012 01:09

Well I know this is not using Tell Application "VLC", but this works without opening the Terminal.

Code: Select all

do shell script "/Applications/VLC.app/Contents/MacOS/VLC -q http://174.123.20.131:8050/ --sout '#duplicate{dst=display,dst=\"transcode{acodec=s16l,ab=192}:standard{mux=wav,dst=/Users/myname/Desktop/bp.wav,access=file}\"}'"
Hope this helps :D

oihewrjdf
New Cone
New Cone
Posts: 2
Joined: 01 Mar 2012 00:15

Re: How to open MRL with options using AppleScript?

Postby oihewrjdf » 02 Mar 2012 20:46

Thank you, kemuel, unfortunately this does not work for me. It opens up VLC, but nothing is being done. Did you try this, and did it work for you? (Yes, I replaced "myname" with the correct username.)

Also, escaping in AppleScript seems to be a bit trickier than backslashes. See this discussion: http://macscripter.net/viewtopic.php?id=13471


Return to “VLC media player for macOS Troubleshooting”

Who is online

Users browsing this forum: No registered users and 16 guests