How to watch youtube live stream using VLC (or other players)

I like to watch @hromadske.tv, which using Youtube to distribute live stream over Internet. I don`t like browser as player, because of many reasons, including:

  1. Stream will die if i need to restart/quit browser
  2. Google like to play with it (html5/swf changes, etc) and sometime it stops working or works buggy
  3. Sometime it is automatically switching to the 720p or 1080p and utilizing too much bandwidth without real need.
  4. VLC and other players supports Remote Control, advanced audio/video control, etc.

To watch live stream in VLC we will need to get stream format first. I am doing this using youtube-dl tool:
bash-3.2$ youtube-dl --list-formats https://www.youtube.com/watch?v=oHZKYHCDy9Q
oHZKYHCDy9Q: Downloading webpage
oHZKYHCDy9Q: Extracting video information
oHZKYHCDy9Q: Downloading formats manifest
oHZKYHCDy9Q: Downloading DASH manifest
[info] Available formats for oHZKYHCDy9Q:
format code extension resolution note
140 m4a audio only DASH audio 144k , m4a_dash container, aac @128k (48000Hz)
141 m4a audio only DASH audio 272k , m4a_dash container, aac @256k (48000Hz)
160 mp4 256x144 DASH video 124k , 15fps, video only
133 mp4 426x240 DASH video 258k , 30fps, video only
134 mp4 640x360 DASH video 616k , 30fps, video only
135 mp4 854x480 DASH video 1116k , 30fps, video only
136 mp4 1280x720 DASH video 2216k , 30fps, video only
137 mp4 1920x1080 DASH video 4141k , 30fps, video only
151 mp4 72p HLS
132 mp4 240p HLS
92 mp4 240p HLS
93 mp4 360p HLS
94 mp4 480p HLS
95 mp4 720p HLS
96 mp4 1080p HLS (best)

I found that HLS format works well with VLC. I will choose 480p (format 94) to use with VLC. It is possible to get URL using this command:
youtube-dl -f 94 -g https://www.youtube.com/watch?v=oHZKYHCDy9Q

Resulted URL can be played by VLC, ffplay from ffmpeg or QuickTime player. Also you can send it directly this way:
vlc youtube-dl -f 94 -g https://www.youtube.com/watch?v=oHZKYHCDy9Q

Advertisements

11 thoughts on “How to watch youtube live stream using VLC (or other players)

  1. Motia says:

    Hi,

    I have question. I tried your trick, and it is working just for some time. after couple of hour, the link is changed.
    is it possible to make the link permanent?

    • sammczk says:

      I dont think so. But i found that link does not change often. I think simple shell/perl script to catch the right link is a way to go.

      • Ashok Machineni says:

        Thanks for nice info. I tried this but it works for some time only after that url which i get with youtube-dl was not working. I don’t know about shell/perl script. Could you please help me how can i get exact url with perl/shell script.

    • sammczk says:

      It depends on the web site. E.g. for hromadske it should be smth like:
      curl ‘http://www.hromadske.tv/’|grep ‘var mainstream ‘

  2. Sean Mann says:

    Doesn’t seem to work for me. I’m able to get the URL from youtube-dl, but VLC only shows the first frame of the video then stops.

    Here’s VLC’s messages about it:
    httplive info: HTTP Live Streaming (manifest.googlevideo.com/api/manifest/hls_playlist/id/y60wDzZt8yg.2/itag/94/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/itag%3D140/sgovp/itag%3D135/hls_chunk_host/r3—sn-3ovavbt-in8e.googlevideo.com/gcr/us/playlist_type/DVR/mm/32/mn/sn-3ovavbt-in8e/ms/lv/mv/m/pl/24/dover/3/upn/3Cq91DpzZAc/sver/3/fexp/9405987,9416126,9416891,9422596,9424334,9425064,9428398,9431012,9433096,9433404,9433705,9433946,9433999,9434289,9434343,9435504/mt/1462349293/ip/75.76.50.45/ipbits/0/expire/1462370955/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,gcr,playlist_type,mm,mn,ms,mv,pl/signature/20EF65121F6DD409FB013E5AD94571682F6057EA.2BD5E487A6C1D16244C7B288F53ADCDAA86769/key/dg_yt0/playlist/index.m3u8)
    ts info: MPEG-4 descriptor not found for pid 0x101 type 0xf
    packetizer_mpeg4audio info: AAC channels: 2 samplerate: 48000
    ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
    ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095
    core error: Could not convert timestamp 0
    ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
    ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095

    Any ideas?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: