Ogg Theora Cook Book

Streaming with ffmpeg2theora

This method focuses on streaming video from a DV or Firewire camera using GNU/Linux (e.g. Ubuntu). The video stream will be Ogg Theora which means your users will be able to watch using Theora enabled player, FireFox 3.5, or in a java applet such as Cortado. To follow this you need to know how to use the command line and you need sudo access. If you have no idea what these things are, then  you should consider reading a good book introducing you to the command line.

Getting Ready

Please note : A Firewire camera is not the same as a DV camera. However for our purposes here they work in the same way. Firewire is Apple's name for the interface standard known as IEEE 1394, other manufacturers use other names such as i.Link (Sony) or Lynx (Texas Instruments) - but it doesn't matter, they are all IEEE 1394.

You will need the following:
  • DV cam
  • GNU/Linux machine with firewire inputs
  • firewire cable
  • internet connection
  • access to a 'theora-enabled' Icecast2 server (you need the IP address of the server, the port you should use, and the password)

Set-Up

Lets start setting up the software you need. We will need to install the following applications:

  • dvgrab
  • ffmpeg2theora
  • oggfwd

With Ubuntu you can run this command line:

sudo apt-get install dvgrab ffmpeg2theora oggfwd 

The above command should all appear on one line. You will be asked for your password, type this in and the installation process will begin. Now you have everything you need to get started. So first we need to plug the dv (or firewire) camera in to the computer. You need to attach the firewire camera to the firewire socket on the camera, and the other end of course goes into the firewire socket of your laptop or whatever computer you are using.

Now, turn on the camera. 

Next you need to enter the following command line, which provides the streaming server details you have for the Icecast2 (theora-enabled) server. The command is:

sudo dvgrab --format raw - | ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o /dev/stdout - | oggfwd  icecastserver  8000 pwd /theora.ogv 

Remember the command will have to be all on one line (the above example is not). Also replace the details below with the information you have about your Icecast server:

  • icecastserver
  • 8000
  • pwd

icecastserver should be replaced with the hostname or IP address of the streaming server. 8000 is the port number and is probably the same. pwd should be replaced by the password of your server. Lastly, you can replace /theora.ogv with your mount point, this depends on the configuration of your icecast server, but can be anything as long as it starts with a forward slash (/) and ends in .ogg or .ogv.

Now, you should be streaming! To check the connection use VLC or Firefox 3.5