Your own live tv feed on the interweb

Posted by yossarian

I did some testing earlier and I actually got a video stream out onto the net and was watching it within about 20 minutes. My head exploded. It was really easy to do.

I was able to view the stream on Linux and Mac OS X using VLC. I was streaming and viewing on the Linux box (a 2.8 Ghz laptop, 512 MB RAM). The CPU sat at about 70% and the machine didn’t look like anything bad was going to happen, I left it running for about 45 minutes and it all seemed cool. The data rates were I think 70 kbps video and 60 kbps audio, which was about 1/4 of my 802.11b wireless card’s bandwidth. So this should work in most wireless situations if you’ve got a decent wifi connection. It was not using very much RAM, it didn’t seem. Hardware requirements should be fairly modest, maybe a 1Ghz machine would do it. We’ll have to do some tests.

At the same time as I was compressing and uploading the stream to http://radio.indymedia.org, I also tried watching it on a different computer.

I fired up VLC (downloadable for Linux, Mac, and Windows from http://www.videolan.org ) and used the “Transcode Wizard” or something to record the video to disk on a G4 Mac. I could view the stream as it was saved, and playback of the saved file worked perfectly as well, so in theory, we could use VLC on a separate box to record the stream, and upload it to the UK newswire or to http://video.indymedia.org as soon as the streaming event is finished. I am not totally sure but I think this laptop would probably be able simultaneously compress the stream and record it to disk using VLC (but if we can use a separate machine to do the recording it’s probably safer).

Below is what I did to set up the box, there are much more detailed instructions at:

http://24.72.34.35/cgi-bin/twiki/view/Main/LinuxVideoFirewire

The Setup

Basically, I just had to make sure the following packages were installed. I’m using Ubuntu, but this should work pretty much the same on Debian (keep in mind that on Ubuntu you would preface the commands below with “sudo”. On Debian you’d need to run them as root).

apt-get install ffmpeg2theora dvgrab

(Note that I already had ffmpeg installed on my machine, I think that’s also necessary).

The next thing I did was download a program called oggfwd. It’s available from http://www.v2v.cc/~j/ffmpeg2theora/oggfwd/oggfwd.linux.bin

Then I decided I trusted the people who made it, and typed this into the terminal to copy the file to a place where I could run it:

mv oggfwd.linux.bin /usr/local/bin/oggfwd
chmod 755 /usr/local/bin/oggfwd

Then, I plugged the camera in and made sure that the system could capture stuff from the firewire port. To do this, I did:

modprobe raw1394

This made sure the Linux kernel loaded up the proper modules to read Firewire input. Then I did a:

chmod 777 /dev/raw1394

This gives all users read/write/execute permissions on the Firewire port. Not wickedly secure on a server machine but good enough for this situation I think, and it gets reset when the machine is restarted.

At that point, I issued the following command (as root) and it connected to the Indy radio server and I was serving a video stream from my house:

dvgrab --format raw - | ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o /dev/stdout  - | oggfwd radio.indymedia.org 8000 thisisnotreallythepassword /rampART.ogg

I am not sure whether it is necessary to be root to do this, we can experiment with permissions a bit.

That’s it, you’ve got your own live video feed, accessible anywhere in the world!

Comments

Leave a response