4

I posted this originally in Super User, and it was suggested that I post this question here, instead ...

I'm using VLC media player 3.0.16 Vetinari under MacOS 11.6.

I want to run VLC from the command line in order to play videoname.mp4.

I know I can do the following:

/Applications/VLC.app/Contents/MacOS/VLC videoname.mp4

However, when I do so, VLC does not start playing the video. Rather, it just displays the VLC playlist GUI window with a videoname.mp4 line, and I have to click on videoname.mp4 in this playlist GUI in order to start playing the video.

If I add --no-playlist-autostart and --play-and-exit command-line options, I get the same behavior.

If I run under Linux, I can use VLC to view the videoname.mp4 video by running the following command. No playlist GUI window pops up, and the video immediately starts playing:

/usr/bin/vlc videoname.mp4

Is there a way with the MacOS VLC program to immediately launch a video directly via the command line, without the VLC playlist GUI popping up at all? I want to launch videos from the command line under MacOS in the same manner that I can do it under Linux.

Thank you in advance for any suggestions.

0

2 Answers 2

3

The following example works for me in Terminal with default setting in VLC and starts the video immediately:

open -a VLC '/path/to/filename.mp4'

In reference to the comment by HippoMan:

I also often want to pass --sub-file /path/to/subtitles.srt , but the following does not work: open -a VLC /path/to/file.mp4 --args --sub-file /path/to/subtitles.srt

If the .srt file is in the same directory as the .mp4 file and is named the same as it, it should get loaded automatically. It does for me, however, the following example also works for me as well:

screen /Applications/VLC.app/Contents/MacOS/VLC --sub-file '/path/to/filename.srt' '/path/to/filename.mp4' &

Note the the command prompt does not automatically return after the command is executed, however, pressing enter causes it to return and the window can continue to be used or closed without terminating the vlc process.

2
  • Thank you. That works if I don't want to pass any extra command-line arguments. However, I also often want to pass --sub-file /path/to/subtitles.srt , but the following does not work: open -a VLC /path/to/file.mp4 --args --sub-file /path/to/subtitles.srt
    – HippoMan
    Sep 26, 2021 at 18:59
  • @HippoMan, I've updated my answer to show how to execute vlc from the command line with _options. Sep 26, 2021 at 20:24
2

Based on the very helpful feedback from Tetsujin and Jean_JD, I have solved my problem:

(1) Using Preferences->Show All->Playist->Auto Start will force the video on the command line to be launched immediately.

(2) Using Preferences->Video->Show video within main window will force the video display window to overwrite (and thereby eliminate) the playlist window.

1
  • Happy for you. ;-}
    – user415185
    Sep 26, 2021 at 18:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .