Whether it be the Flash Player or the HTML5 player, there are times when YouTube’s browser player is less than adequate, such as no full screen or excessive stuttering. An external player usually plays videos instantly and with improved motion smoothness.
Also, maybe it is just me, but something seems broken or unreliable lately when attempting to play YouTube videos in VLC (VideoLAN Client).
It used to be that you could simply copy and paste the YouTube video URL into VLC or almost any other media player, and the player would play the video without hassle. There were even browser plugins facilitating the process. Now, VLC is giving me MRL errors.
Sometimes it works, sometimes it does not. Regardless, there are times when an external player, such as VLC, may be preferred. Can we still use VLC for YouTube videos?
While this how-to uses Firefox and VLC on Linux Mint 17.3 Cinnamon as an example, it should work with other browsers and Linux distributions.
Sometimes, if you try to play a YouTube video in VLC, you will see an error message regarding an “unable to open MRL” issue. This means VLC cannot properly parse the YouTube URL. Other times, VLC will stay blank.
VLC is not alone. Other media players might have issues and refuse to play the video.
Update July 2016: VLC 2.2.2 in Linux Mint 18 plays YouTube videos by copying and pasting the link into VLC, so this article might not be necessary for Linux Mint 18.
Certainly, there are ways to obtain the playback URL. One example is the YouTube Video Info site that shows detailed information about the audio and video streams available for a given YouTube video.
This requires work, and there are other ways to obtain the stream URLs. We want to configure a simple “open with VLC” option.
Step 1. Set Up VLC
Update November 20, 2016: This site for youtube.lua has been offline, but a search for youtube.lua should return mirrors.
This is a VLC plugin written in Lua that enables the proper parsing of YouTube video URLs so they will play in VLC.
Step 2. Copy youtube.lua to VLC
VLC needs this plugin in its playlist directory. On Linux Mint 17.3, this is located at /usr/lib/vlc/lua/playlist.
sudo cp youtube.lua /usr/lib/vlc/lua/playlist
Copying to this location applies the plugin system-wide for all users. However, this location might vary by operating system and distribution, so double check. You should see that other Lua plugins are already present by default.
Step 3. Test if the VLC Plugin Works
Close VLC (if open) and reopen it. Find a video you like on YouTube and copy and paste its URL into VLC (“Open Network Stream”). VLC should play the video. If not, then these instructions might be obsolete since YouTube has been known to change its URL format from time to time, making certain plugins unusable.
Step 4. Install a Browser Plugin for Easier Playback
Now that VLC is set up to play YouTube videos, let’s add a browser plugin so we only need to click a video to make it play in VLC instead of copying and pasting the URL.
Simply middle-click (the mouse wheel button) on a YouTube link (except for the embedded YouTube player), and it plays in VLC. How easy is that?
Avoid Double Playback
Depending upon your browser configuration, you might notice that the YouTube video will play in both the browser and VLC simultaneously. Let’s prevent that.
We need to install a browser plugin that prevents YouTube videos from auto-playing in the browser. This way, they play in VLC only when you tell them to start. One plugin (for HTML5 playback) is StopTubeHTML5.
There are two types of browser YouTube players: Flash and HTML5. You might need plugins for both in order to suppress playback since the HTML5 suppression still allows Flash videos to play. For example, StopTubeHTML5 will prevent HTML5 videos from playing, but not Flash videos using the Flash player. (At least as of the time of this writing.)
There are myriads of browser plugins available, so experiment with what you need.
So what can we expect with VLC playback?
- No ads! Videos play without ads. Go straight to the video and start watching.
- No annoying popup annotations. Some YouTube posters go overboard with constant bombardment of text boxes that pop up while the video is playing. Ug. These do not appear in VLC. As you might expect, there is a browser plugin that suppresses annotations when videos are played within the browser.
- Only 720p and lower. YouTube uses DASH to play 1080p and higher videos. With the technique shown in this article, you will be limited to 720p video resolution. Yes, you can play 1080p, 2K, 4K, and 8K YouTube videos with audio in VLC as synchronous streams, but this requires more effort if performed manually. The aim here is to provide a simple “click to play” how-to.
- Playlists work. This might depend (in part) upon the browser plugin you choose to use, but you can open a YouTube playlist in VLC and VLC will play the entire playlist.
- Nothing is guaranteed. YouTube has changed formats and access to its videos in the past, so expect some things to break over time. It is a cat and mouse game, after all.
The key is to add the youtube.lua plugin to VLC so it will properly parse the latest YouTube video URLs. Once that is done and VLC plays the video, then the rest is browser customization. Other video players will require their own tweaking.
If you are having trouble playing YouTube videos in your browser for whatever reason and find a need to use an external video player for playback, then these ideas might help.