Difference between revisions of "External proxy"
(Minor changes) |
(→Troubleshooting) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 23: | Line 23: | ||
Fortunately, work is being done by RMerlin to create a stand-alone Virtual Appliance that has all the code necessary to run the proxy. You just need to download the virtual machine, bridge the virtual network adapter to your network card and configure the plugins to use the proxy | Fortunately, work is being done by RMerlin to create a stand-alone Virtual Appliance that has all the code necessary to run the proxy. You just need to download the virtual machine, bridge the virtual network adapter to your network card and configure the plugins to use the proxy | ||
+ | VM main thread and download link: http://forum.wdlxtv.com/viewtopic.php?f=49&t=5149 | ||
VM discussion here: http://forum.wdlxtv.com/viewtopic.php?f=49&t=4795 | VM discussion here: http://forum.wdlxtv.com/viewtopic.php?f=49&t=4795 | ||
Line 109: | Line 110: | ||
cp gemist-proxy.php /var/www/proxy.php | cp gemist-proxy.php /var/www/proxy.php | ||
The webserver, with the default settings should allow the proxy to work. Next, you will need to configure the plugins above to point to your proxy (which is http://''ip-address''/proxy.php) | The webserver, with the default settings should allow the proxy to work. Next, you will need to configure the plugins above to point to your proxy (which is http://''ip-address''/proxy.php) | ||
+ | Example | ||
+ | http://192.168.1.123/proxy.php | ||
==Troubleshooting== | ==Troubleshooting== | ||
Line 131: | Line 134: | ||
2 packets transmitted, 2 received, 0% packet loss, time 1000ms | 2 packets transmitted, 2 received, 0% packet loss, time 1000ms | ||
rtt min/avg/max/mdev = 33.347/34.400/35.454/1.069 ms | rtt min/avg/max/mdev = 33.347/34.400/35.454/1.069 ms | ||
+ | |||
+ | * Enable/configure cgi by edditing /etc/apache2/httpd.conf | ||
+ | More info on cgi can be found at http://httpd.apache.org/docs/current/howto/cgi.html | ||
* Check the apache error log (/var/log/apache2/error.log) for errors | * Check the apache error log (/var/log/apache2/error.log) for errors |
Latest revision as of 09:51, 15 December 2011
Contents
Why do I need an external proxy?
Not all video content is playable directly by the WDTV. This is because certain codecs and file formats are not supported by the firmware. In order to play back such content, you need to convert it to something that is playable on the WDTV, and you need to do this in real-time. This process is called "transcoding" [1]
An external proxy is a piece of software that acts as a gateway between the plugins of WDTV and the video file hosted on a remote server. The proxy has the difficult job to get the video from the remote server and convert it in place and send back the converted stream to the UMSP plugin. Since the conversion process is CPU intensive, it can't be done in real-time on the WDTV (trust me, we've tried), so it needs to be done on a PC/server with sufficient CPU/memory.
The proxy implementation is done by shunte, and can be used by the following plugins:
- Tou.tv
- SVT Play
- PBS
- Gemist
- Youjizz
Dependencies
In order to work, the proxy code needs the following:
- Linux/UNIX OS (to be able to pipe output between commands)
- apache
- php
- rtmpdump
- ffmpeg
- msdl
The easy way - Get a prepackaged virtual machine
Fortunately, work is being done by RMerlin to create a stand-alone Virtual Appliance that has all the code necessary to run the proxy. You just need to download the virtual machine, bridge the virtual network adapter to your network card and configure the plugins to use the proxy
VM main thread and download link: http://forum.wdlxtv.com/viewtopic.php?f=49&t=5149 VM discussion here: http://forum.wdlxtv.com/viewtopic.php?f=49&t=4795
The hard way - Install the necessary packages
If you want to install the necessary packages on your own linux server, you can use this as a guide, but you will need to have some linux knowledge to do this.
This guide assumes you are working with Ubuntu or a Debian derivative. The commands can be easily adapted to other distros. The commands have been tested on Ubuntu 10.04, as user root.
Installing apache
Install the apache web server
apt-get install apache2
Install php
Install the php5 packages
apt-get install php5 php5-cgi php5-cli php5-common php5-curl libapache2-mod-php5
Install ffmpeg
FFMpeg is a tool to do transcoding of video content. You can install your distribution's version, but it's recommended to install the latest version available
apt-get install ffmpeg
Personally, I've had problems with older ffmpeg versions (segmentation faults on certain clips). If you want a newer version (I'm using 0.8-4:0.8-0ubuntu1~jon2), you should search for a ppa for your distro, add it and install the ppa package. I have used the following ppa for 10.04:
deb http://ppa.launchpad.net/jon-severinsson/ffmpeg/ubuntu lucid main deb-src http://ppa.launchpad.net/jon-severinsson/ffmpeg/ubuntu lucid main
Install rtmpdump
rtmpdump is a tool to sniff rtmp streams. Since there are periodic changes to the protocols used, you should always install this from source.
1. Make sure you have git installed
apt-get install git-core
2. Download the latest git image for rtmpdump
git clone git://git.ffmpeg.org/rtmpdump cd rtmpdump
3. Install the required libssl development packages
apt-get install libssl0.9.8 libssl-dev
4. Install a minimal build environment
apt-get install gcc make
5. Compile rtmpdump (output should look like this):
root@phobos:/home/adrianp/rtmpdump/rtmpdump# make SYS=posix SHARED= make[1]: Entering directory `/home/adrianp/rtmpdump/rtmpdump/librtmp' gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -DUSE_OPENSSL -O2 -c -o rtmp.o rtmp.c gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -DUSE_OPENSSL -O2 -c -o log.o log.c gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -DUSE_OPENSSL -O2 -c -o amf.o amf.c gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -DUSE_OPENSSL -O2 -c -o hashswf.o hashswf.c gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -DUSE_OPENSSL -O2 -c -o parseurl.o parseurl.c ar rs librtmp.a rtmp.o log.o amf.o hashswf.o parseurl.o ar: creating librtmp.a make[1]: Leaving directory `/home/adrianp/rtmpdump/rtmpdump/librtmp' gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -O2 -c -o rtmpdump.o rtmpdump.c gcc -Wall -o rtmpdump rtmpdump.o -Llibrtmp -lrtmp -lssl -lcrypto -lz gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -O2 -c -o rtmpgw.o rtmpgw.c gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -O2 -c -o thread.o thread.c gcc -Wall -o rtmpgw rtmpgw.o thread.o -lpthread -Llibrtmp -lrtmp -lssl -lcrypto -lz gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -O2 -c -o rtmpsrv.o rtmpsrv.c gcc -Wall -o rtmpsrv rtmpsrv.o thread.o -lpthread -Llibrtmp -lrtmp -lssl -lcrypto -lz gcc -Wall -DRTMPDUMP_VERSION=\"v2.4\" -O2 -c -o rtmpsuck.o rtmpsuck.c gcc -Wall -o rtmpsuck rtmpsuck.o thread.o -lpthread -Llibrtmp -lrtmp -lssl -lcrypto -lz root@phobos:/home/adrianp/rtmpdump/rtmpdump# ./rtmpdump RTMPDump v2.4 (c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL ERROR: You must specify a hostname (--host) or url (-r "rtmp://host[:port]/playpath") containing a hostname
6. Run make install to copy the binaries to their correct locations
make install
7. Link the binaries somewhere in the path, so that the script can find them
ln /usr/local/bin/rtmpdump /usr/bin/rtmpdump ln /usr/local/sbin/rtmpgw /usr/sbin/rtmpgw ln /usr/local/sbin/rtmpsrv /usr/sbin/rtmpsrv ln /usr/local/sbin/rtmpsuck /usr/sbin/rtmpsuck
Install msdl
In short, msdl is a downloader for mms:// or rtsp:// urls. In other words, msdl is an open source download client for rtsp,mms,or mmsh. It is recommended that you compile it from source
1. Download and unpack the latest msdl source code from http://msdl.sourceforge.net
mkdir msdl cd msdl wget -O msdl.tar.gz "http://sourceforge.net/projects/msdl/files/msdl/msdl-1.2.7-r2/msdl-1.2.7-r2.tar.gz/download" tar zxvf msdl.tar.gz cd msdl-*
2. Compile the program
./configure --prefix=/usr make make install
Putting it all together
Copy shunte's proxy.php code (currently the latest version is part of the gemist plugin: http://forum.wdlxtv.com/viewtopic.php?f=53&t=4017) somewhere in your server's webpath:
cp gemist-proxy.php /var/www/proxy.php
The webserver, with the default settings should allow the proxy to work. Next, you will need to configure the plugins above to point to your proxy (which is http://ip-address/proxy.php) Example
http://192.168.1.123/proxy.php
Troubleshooting
If you can't play back videos through the proxy, you might want to test the following:
- Make sure you have IP connectivity between the WDTV and your server/VM. Assuming the IP address on the server/VM is 192.168.1.100, the following command should work when issued from your WDTV telnet/ssh:
ping -c 2 192.168.1.100 PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data. 64 bytes from 192.168.1.100: icmp_seq=1 ttl=64 time=0.276 ms 64 bytes from 192.168.1.100: icmp_seq=2 ttl=64 time=0.473 ms --- 192.168.1.100 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.276/0.374/0.473/0.100 ms
- Make sure your server/VM has connectivity to the internet - e.g. you should be able to ping google.com from your server/VM
ping -c 2 google.com PING google.com (209.85.148.99) 56(84) bytes of data. 64 bytes from fra07s07-in-f99.1e100.net (209.85.148.99): icmp_seq=1 ttl=55 time=33.3 ms 64 bytes from fra07s07-in-f99.1e100.net (209.85.148.99): icmp_seq=2 ttl=55 time=35.4 ms --- google.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 33.347/34.400/35.454/1.069 ms
- Enable/configure cgi by edditing /etc/apache2/httpd.conf
More info on cgi can be found at http://httpd.apache.org/docs/current/howto/cgi.html
- Check the apache error log (/var/log/apache2/error.log) for errors