Programming
20 May 2012 9 Comments

How to play UStream channels in VLC

Introduction

Ustream.tv doesn’t support opening streams in VLC by default, but it is possible with some effort. Most video streaming sites use the Real Time Messaging Protocol (RTMP) for transmitting video data to your flash player. Using rtmpdump we can connect to RTMP streams, and record them or play them in VLC.

1: Install rtmpdump

On Ubuntu:

$ sudo apt-get install rtmpdump

Binaries for all platforms: here.

2: Find the RTMPDump Parameters

It’s not trivial to find out the correct parameters for rtmpdump, so use this Python script:

#!/usr/bin/env python
# This script finds the rtmpdump command syntax for opening a UStream stream.
 
import sys
import urllib2
import re
 
 
def getVideoData(url):
    # Get the HTML contents
    req = urllib2.Request(url)
    response = urllib2.urlopen(req)
    html = response.read()
 
    # Extract the channel ID from the HTML
    channelId = None
    m = re.search("Channel\sID\:\s+(\d+)", html)
    if (m):
        channelId = m.group(1)
 
    # Extract the channel title from the HTML
    channelTitle = None
    m = re.search("property\=\"og\:url\"