20

I would like to play youtube videos on VLC. I am newbie (one of mac os re, but can fallow instructions :) when i enter address on network stream nothing happens it is on the playlist but nothing happens it is not playing. I have a firewall if it helps :)

Problem solved thanks to your help!!

phoibos
  • 21,016
  • 4
  • 48
  • 47
user94159
  • 283
  • 2
  • 3
  • 7

2 Answers2

38

I assume you entered the URL correctly (no https but http, and only the v=... part, like http://www.youtube.com/watch?v=-wxawmjnRWY)?

Open the Extras menu and click on Messages. Now click play again and see what message's there.

My guess is it's

lua error: Couldn't extract youtube video URL, please check for updates to this script

VLC parses YouTube's HTML source code to look for the video, but sometimes, YouTube changes its way it outputs the HTML, so VLC is unable to find the video URL.

Possible workarounds

  • Go to https://www.youtube.com/html5 and enable html5 there to play the video in your browser without flash
  • Install minitube and try to play the video there
  • Wait for an update of VLC (or update the lua script yourself - not so easy, see Updating the VLC YouTube parser)
  • Install the package youtube-dl and download the video to your harddisk. It's a command line utility though

Updating the VLC YouTube parser

Update just the Lua script for YouTube parsing to the latest version from VLC:

Open the Terminal application and enter these commands:

Make sure curl is installed, we need this to download the new file

sudo apt-get install curl

Get rid of the old, non-working scripts

sudo rm /usr/lib/vlc/lua/playlist/youtube.*

Download the current ones (use the whole command line, yes, it's quite long):

sudo curl "http://git.videolan.org/?p=vlc.git;a=blob_plain;f=share/lua/playlist/youtube.lua;hb=HEAD" -o /usr/lib/vlc/lua/playlist/youtube.lua

See if it works.

phoibos
  • 21,016
  • 4
  • 48
  • 47
  • 1
    Here's the bug report: https://trac.videolan.org/vlc/ticket/7471 – Chan-Ho Suh Oct 08 '12 at 12:01
  • 2
    According to the bug reporter, here's a github for the patched lua script: https://gist.github.com/3729932 – Chan-Ho Suh Oct 08 '12 at 12:02
  • We need more infos. Open in VLC: "Extras" > "Messages", with that open, enter the youtube url for the network stream, hit play and see if any messages appeared, and tell us about it :D – phoibos Oct 10 '12 at 16:44
  • sorry for the late reply, despite my efforts the problem remains: 1. the VLC message is exactly the one you have guest Couldn't extract youtube video URL, please check for updates to this script. 2. i really need to be able to play it in some kind of player and not browser :/ 3. I have tried minitube but i doesnt work also it shows this in terminal Error: "/var/tmp/kdecache-izdininkas" is owned by uid 1000 instead of uid 0. i have tried to google it but i can hardly understant what the problem is about 4. i have tired youtube-dl but i get ERROR: unable to download video. – user94159 Oct 10 '12 at 16:47
  • 3
    I've updated my post, see "Updating the VLC YouTube parser". I was able to play videos with VLC after this. – phoibos Oct 10 '12 at 17:25
  • and one more thank you :) and i haven't copied! Everything worked! :) Good guy phoibos: SEES A PROBLEM - SOLVES IT! ̃ – user94159 Oct 10 '12 at 19:50
  • 2
    For a second I thought [I was boned](http://xkcd.com/1316/), but that last suggestion actually worked! So +1 for you, and I'm totally bookmarking this for the next time this happens. – Braden Best Jun 09 '14 at 04:22
  • Thanks, i had this problem on the latest VLC in ubuntu 14.04, some videos would play and some wouldn't, updating the parser solved it. – SomeNickName Jun 10 '16 at 19:38
  • On ubuntu linux using version 2.6-6 I had to copy the downloaded youtube.lua file to `~/.local/share/vlc/lua/youtube.lua` and also `~/.local/share/vlc/lua/playlist/youtube.lua` it seems the installation is slightly different. https://www.videolan.org/developers/vlc/share/lua/README.txt – Japheth Ongeri - inkalimeva Mar 01 '18 at 08:27
  • 2
    1. In my case with 18.04 the output was to `/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.lua` (just a `youtube.luac` before there). 2. Didn't work with error _ts demux error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 0_ (with somes _adaptive demux: Encountered discontinuity_ before). They are moving all to GitLab [here](https://code.videolan.org/). – Pablo Bianchi Mar 10 '19 at 03:04
  • on ubuntu 14.04 works fine, 8 years after ! – Romain Jouin Apr 12 '20 at 21:28
  • I confirm that on Ubuntu 18.04, `cd /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/; sudo rm youtube.luac; sudo curl "http://git.videolan.org/?p=vlc.git;a=blob_plain;f=share/lua/playlist/youtube.lua;hb=HEAD" -o youtube.lua` solves the issue. – Immanuel Weihnachten Jun 10 '20 at 14:35
  • On Linux Mint 20.2 (Uma) with VLC 3.0.9.2 (Vetinari), like Pablo, `/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.lua` was the output location . But it did work for me. – Julien Lamarche Sep 19 '22 at 18:31
4

You can run the latest Lua script for extracting YouTube streams by downloading the appropriate file into your home directory. There's no need to delete or modify system-level files. This works just fine:

mkdir -p ~/.local/share/vlc/lua/playlist/
curl 'https://code.videolan.org/videolan/vlc/-/raw/master/share/lua/playlist/youtube.lua' -o ~/.local/share/vlc/lua/playlist/youtube.lua

or with wget:

mkdir -p ~/.local/share/vlc/lua/playlist/
wget -q -O - 'https://code.videolan.org/videolan/vlc/-/raw/master/share/lua/playlist/youtube.lua' > ~/.local/share/vlc/lua/playlist/youtube.lua

VLC will use local scripts instead of the system level Lua file here:

/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac

By using a local file in your home directory, you don't have to worry about the file being overwritten when the VLC package is upgraded with apt upgrade or similar.

Relevant links:

Nathaniel M. Beaver
  • 1,478
  • 12
  • 32