OSX: using CLI version of VLC

22

5

How can I use the CLI version of the VLC on OSX?

After installing VLC on OSX, it works fine through the normal GUI process, spotlight, etc. Also, I know it's possible to do

open bla.avi -a vlc

However, when I issue vlc command in the shell, it doesn't work. which vlc in shell doesn't return anything either.

CLI version of VLC is very handy for transcoding, streaming, etc. So it would be nice to have it working.

lang2

Posted 2012-12-19T16:16:36.457

Reputation: 1 830

1What is your question here? Are you just looking for the command? What have you tried? – Baarn – 2012-12-19T16:21:01.203

Under linux when I issue vlc in terminal it tells me to use cvlc I guess it would be the same under OSX. – Baarn – 2012-12-19T16:22:27.440

So I'm assuming that you downloaded VLC... it should ship the needed command line tools with the program... it can do transcoding, streaming, "etc", but you need to provide a specific use case in order for us to provide any detailed information. – allquixotic – 2012-12-19T16:22:44.390

please don't write it doesn't work because I am pretty sure that it works, just not in the way you expect it to. So please tell what you want and what you get instead. – Baarn – 2012-12-19T16:31:19.970

And by the way man vlc – Baarn – 2012-12-19T16:33:11.933

@Informaficker have you actually used vlc cli on OSX? Looking at "I guess" it looks like you haven't. Please please stop giving false information unless you're sure what you're saying. ps. man vlc on OSX doesn't work either. – lang2 – 2012-12-19T16:40:49.390

@lang2 I am trying to help you here, but you seem not willing or able to explain what you are expecting from vlc, what you tried and what you want to do. – Baarn – 2012-12-19T16:50:19.123

Eg how did you install vlc, from where are you trying to execute, have you added vlc to your path? – Baarn – 2012-12-19T16:52:05.240

3@allquixotic Unfortunately, on OS X, VLC doesn't install the command line version. – slhck – 2012-12-19T17:34:09.390

Answers

23

The command open bla.avi -a vlc works because OS X is using its Launch Services database to open the application VLC. This doesn't have anything to do with a command line binary of the same name, which isn't installed by default.

The binary you search for is in the VLC.app package, so you can type that into a terminal:

/Applications/VLC.app/Contents/MacOS/VLC -I rc

This will open the interactive command line VLC. Or, execute the following in order to have the above line registered as an alias to vlc:

echo "alias vlc='/Applications/VLC.app/Contents/MacOS/VLC -I rc'" >> ~/.bash_profile

Once you've added this, you need to restart your Terminal. Now type vlc and you'll get to the command line.

If you don't like the interactive interface or would like to use VLC with other options, you need to edit your ~/.bash_profile accordingly, e.g. through open -e ~/.bash_profile.

slhck

Posted 2012-12-19T16:16:36.457

Reputation: 182 472

1Remove -I rc from the command if you actually DO want the GUI to open via the command line vlc command. – MikeiLL – 2016-12-13T20:52:28.763

4@MikeiLL You could also just call open -a VLC. This works with any app in OS X. – slhck – 2016-12-14T13:12:56.093

I prefer to call this alias cvlc to make it clear it is the command line VLC (and to also be consistent with the linux version). – lenooh – 2018-10-26T15:44:04.213

3

OS X applications don't usually install any program executables outside their application bundle. As you don't usually interact with them from the command line, they're not put into any folder on your PATH.


If you installed VLC to /Applications, the actual executable is /Applications/VLC.app/Contents/MacOS/VLC.

/Applications/VLC.app/Contents/MacOS/VLC -hwill show some help, and /Applications/VLC.app/Contents/MacOS/VLC --intf ncurses will launch the ncurses UI.

Daniel Beck

Posted 2012-12-19T16:16:36.457

Reputation: 98 421

the --intf ncurses flag is cool – cwd – 2015-03-09T02:36:09.043

2

To access vlc from the command line, you can create a local symbolic link as below:

mkdir ~/bin
ln -vs /Applications/VLC.app/Contents/MacOS/VLC ~/bin/vlc

To have this command available for all users, you may want to link it into /usr/local/bin instead.

Make sure that your ~/bin (or /usr/local/bin) is in your environmental PATH variable, in other words that your ~/.profile file contains something like:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Above code is default behaviour on Linux.

kenorb

Posted 2012-12-19T16:16:36.457

Reputation: 16 795

1

FYI and/or a tip.

Here're 2 ways to find out the actual path of the app that launches with open command.

Helpful, in case of that the VLC is placed in another directory rather than /Applications, such as /Users/<user>/Applications (~/Applications) or other directories.

Via AppleScript

Simple but it launches the app.

$ osascript -e 'POSIX path of (path to application "VLC")'
/Applications/VLC.app/
$ 
$ osascript -e 'POSIX path of (path to application "GIMP")'
/Volumes/External_HDD/Applications/GIMP/GIMP_v2.8/GIMP.app/

Via lsregister command

Little complicated but won't launch the app.

$ # Path of `lsregister` command
$ #   /System/Library \
$ #     /Frameworks/CoreServices.framework/Versions/A \
$ #     /Frameworks/LaunchServices.framework/Versions/A/Support/
$ 
$ cd /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/
$ 
$ ls
lsregister
$ 
$ # Sample usage
$ ./lsregister -dump | grep -o "/.*\Google Chrome.app" | head -1
/Applications/Google Chrome.app
$ 
$ # Find VLC
$ NAME_APP=VLC
$ ./lsregister -dump | grep -o "/.*${NAME_APP}.app" | grep -v -E "Caches|TimeMachine|Temporary|/Volumes/${NAME_APP}" | uniq
/Applications/VLC.app

Tested on: macOS HighSierra (OSX 10.13.6)

$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
Copyright (C) 2007 Free Software Foundation, Inc.

KEINOS

Posted 2012-12-19T16:16:36.457

Reputation: 11

1

The dummy interface allows batch operation on the command line. I use a shell script like this saved in /usr/local/bin/vlc:

    export VLC_PLUGIN_PATH=/Applications/VLC.app/Contents/MacOS/plugins
    /Applications/VLC.app/Contents/MacOS/VLC -I dummy "${@}"

larrycz

Posted 2012-12-19T16:16:36.457

Reputation: 11

0

First, you need to locate the actual binary executable in the VLC Mac application package. Open Finder, go to the Applications folder, right-click on the VLC app and then click Show Package Contents. Now you can browse what's actually inside.

In this case, the VLC binary is located in the Contents/MacOS folder as file VLC. Open Terminal and enter the exact file path to this, and you'll find the VLC binary executes: /Applications/VLC.app/Contents/MacOS/VLC. If you don't want to use this whole path every time, you can make a symlink and edit your Bash PATH to point to this.

Now that you can call the binary right from the CLI, you probably will want to pick an interface so that you don't have the usual GUI popping up. A full list of available interfaces are at the VLC Interfaces wiki page.

Once you find the working set of commands for your VLC CLI calls which produces your intended output, you'll probably want to use the dummy interface when calling VLC in your program/batch processing. The dummy interface is basically nothing but output in the Terminal like most non-interactive CLI programs.

End result: /Applications/VLC.app/Contents/MacOS/VLC -I dummy [further parameters here]

I recommend using the -vvv parameter so you get extensive log output to help as you test different commands.

TheKarateKid

Posted 2012-12-19T16:16:36.457

Reputation: 195