Dienstag, 1. Juni 2010

Streaming video to the big screen

This is a pretty obvious hack and nothing new at all, using plain command line tools that existed for ages. Still, it might come in handy, and maybe you did not even think about it yet:

Prerequisites are a computer with an installed SSH server and mplayer or a similar media player. On your N900 (this obviously works just as well for the N800 and N810), you just need the SSH client for the first variant, and Python for the second variant. No other tools or apps are necessary.

In my case, I downloaded a video onto my N900 using gPodder, but I didn't want to watch it on the small screen, and I don't have a TV to hook it up to. So I decided to just stream the video over the network to my computer (ideally initiating the stream from the N900).

What you need to do is find out the $DISPLAY variable in your X session on the computer (:0 usually works, but strangely I'm on :4.0 with Ubuntu 10.04 here). You can do this with echo $DISPLAY in a X Terminal on the computer. Remember that value. Now, let's go to the X Terminal on the N900, cd into the folder with the videos and note the file name. To stream the video fullscreen to the computer, use a command like this: ssh username@computerip 'DISPLAY=:4.0 mplayer -fs -' < filename.mp4.

If you don't have SSH access, an alternative is to use HTTP for streaming (e.g. with VLC, which is also available on Windows and Mac OS X). The easiest way to do is (if you have Python installed, which you most likely have) to cd into the directory that you want to share (the directory and all its subdirectories will be shared - be sure to have no sensitive data there!) and use the command python -m SimpleHTTPServer for some instant HTTP server goodness on port 8000. Use VLC or a web browser on your computer to access the share. You can use Ctrl+C to stop the server.

So, if you want to browse the downloaded podcasts of gPodder on your computer, use the following command sequence in X Terminal:

cdcd MyDocs/Podcastspython -m SimpleHTTPServer

Now, use the web browser on your computer (connected to the same network) and access http://n900ipaddress:8000/ to get a directory listing of all downloaded content. Copy the URLs into VLC and start streaming over the air.

Usually the limiting factor here is the wireless bandwidth and the reading speed of the eMMC. Apart from that, no restrictions apply - you can easily stream HD content, as the decoding is done on your computer, and the N900 just reads the data and sends it unmodified over the network without much processing (that's why everything said here also applies to the N800 and N810 and should work just as well).