Saturday, June 6, 2009

How to run multiple instances of VLC

Have you ever wanted to run multiple instances of VLC at the same time? There are times where I like to keep an old football game going while watching a movie. But unfortunately, VLC has never provided this functionality although there are ways around.


First you could run the application from the command line to launch multiple instances. It is quite easy to do but if you watch videos often then it quickly becomes an inconvenience.

MacBook :~ mactimes$ /Applications/VLC.app/Contents/MacOS/VLC &

I've also heard of people making multiple copies of the application in order to run multiple instances of VLC.

There is an easier options. By following this guide, I will show you how to run multiple instances of the application. In addition, show you how to change a few settings so the changes are transparent.

This guide will be composed of 4 steps:
  1. Launcher creation
  2. Icon image update
  3. Copy launcher to dock
  4. File association???
note: It is assumed that VLC is installed. If not, please download and install it from the Mac VLC download page.

Launcher Creation:
  1. Start by opening Script Editor (Applications -> AppleScript -> Script Editor)

  2. In the upper window type the following command:



    do shell script "open -n /Applications/VLC.app"

    note: The "-n" refers to new so that you can open multiple applications

  3. Click "Compile" to analyze the script and check for errors

  4. Then save the script as "VLC" with the File Format changed to Application.



  5. You will end up with a launcher on your Desktop that looks like the following icon



  6. Launch the icon multiple times and you should get multiple instances of VLC
Icon Image Update: The default script icon is obviously not very attractive so lets change it to the VLC icon.
  1. Select the original VLC application in Finder.

  2. Right-Click on the VLC application icon and select Get Info.

  3. In the properties window, there is a small icon of the application in the upper left hand corner. Select this icon (you will see it highlighted).



  4. Copy the icon (Edit -> Copy or ⌘C) to your clipboard.

  5. Select the new VLC launcher on your desktop.

  6. Right-Click on the VLC launcher icon and select Get Info.

  7. In the properties window, go to the small icon in the upper left hand corner. Select this icon (you will see it highlighted).

  8. Paste the icon (Edit -> Paste or ⌘V) from your clipboard.

  9. The icon will change from the default script icon image to the VLC icon image.



  10. The icon on your desktop will also change from the default script icon image to the VLC icon image.


Copy launcher to dock:
  1. Open Finder and move the new VLC script to Macintosh/Users//Library/Scripts.

  2. Drag the new VLC script to your dock.

  3. Click on the dock icon to launch new instances of VLC.


File Association: To ensure your videos open with the new launcher you need to change the default application for all the movie types. I thought this would be easy to configure by just point the file extensions to the new VLC script but unfortunately it does not work. I will leave this a work in progress and post an update when I find a solution.


So there you go, a quick and easy solution to launching multiple instances of VLC. Its not perfect but it is much more convenient then launching the application from the command line. And when I find a solution for the file association I will keep you all updated. Just as a final note, this process should work for any application you would like to run multiple instances of.


25 comments:

  1. Kinda long but it worked well.
    It was well worth the time.
    Thanks for the walkthrough.

    ReplyDelete
  2. You are the best. Is a follow up coming how
    to link the script with a playlist?
    VLC on Pc hast multi instances.
    thanks ever so much.

    ReplyDelete
  3. Worked perfectly, thanks!

    ReplyDelete
  4. Glad to hear that this was useful.

    For Anonymous, unfortunately I do not use playlists. But that does not mean I cannot have a look to see if I can figure something out. Will let you know if I figure that one out, or potentially create a follow-up post.

    ReplyDelete
  5. Awesome. Works just great. I was just looking for how to do this last week.

    Great Job. Confirmed works with 1.01

    ReplyDelete
  6. Thank you. Works great

    ReplyDelete
  7. Just a little help. With this code you can fix the problem of the FILE ASSOCIATION.

    Change variable VLCdir to the folder containing VLC.app

    on open selected_file
    set VLCdir to "/Applications"
    set source to POSIX path of selected_file
    tell application "Terminal"
    do script "\"" & VLCdir & "/VLC.app/Contents/MacOS/VLC\" \"" & source & "\""
    quit saving no
    end tell
    end open

    ReplyDelete
  8. Sorry, I forgot to say that you have to copy&paste that code at the end of this site's original code

    ReplyDelete
  9. Thanks! I'm in the middle of switching to Mac from WinXP and couldn't figure this out.

    ReplyDelete
  10. I say thee THANKS! Indeed!

    I switched to Mac from PC permanently about 2 years ago and have been looking for a solution ever since!

    You the MAN!

    I even used your script to add a specific file (a webcam) to the new playlist!

    ReplyDelete
  11. this is awesome!!!!! Thank-you!!! :-)

    ReplyDelete
  12. I got an applescript error saying:
    open[621] No such file: /-n

    ReplyDelete
  13. Could someone please update the guide regarding file associations. Didnt succeed in changing that..

    ReplyDelete
  14. The author made another post regarding this:
    http://www.mactimes.info/2009/06/how-to-run-multiple-instances-of-vlc_18.html

    ReplyDelete
  15. Wow, excellent, thanks!

    ReplyDelete
  16. Does anyone have an idea how to simultaneously start playback on multiple vlc instances? With something like a global shortcut?

    ReplyDelete
  17. great.still working on OS10.8

    ReplyDelete
  18. Could someone explain me this step :

    Open Finder and move the new VLC script to Macintosh/Users//Library/Scripts.

    because without this one, the script isn't identify as an app
    so define it by default for opening files is impossible :-(

    ReplyDelete
  19. Thank You. Works great on OSX 10.8.5 Mountain Lion and VLC 2.1.0

    ReplyDelete
  20. Hi below is another script that work more faster.

    Use same procedure as describe to save it as app


    script :

    on run
    do shell script "open -n /Applications/VLC.app"
    end run

    on open theFiles
    repeat with theFile in theFiles
    do shell script "open -na /Applications/VLC.app " & quote & (POSIX path of theFile) & quote
    end repeat
    end open

    ReplyDelete
  21. And how to run these two VLC independently on two screens for an exhibition (full screen on each one, under applescript control)? I mean: openURL on screen 1, openURL on screen 2, and so on, without any other user intervention, all activated by external events starting two applescripts)

    ReplyDelete
  22. Your article very well and good, bringing inspiration to many. I hope people visit my website.
    Friv 11 | K7x |A10 Online |Firv |Yoob 5 .

    ReplyDelete
  23. I know there will be many difficulties and challenges but I am determined to do it. If it does not succeed then it will be a lesson for me as well
    catmario4.com

    ReplyDelete