ffmpeg2theora

ffmpeg2theora is a very useful application that enables you to manipulate all kinds of video with the Ogg Theora video file format ('codec').

Its pretty impossible to give a quick summary of what ffmpeg2theora can do as it is a very powerful application. You can send live video from a video camera across the internet, capture video from a DV camera, convert other formats to Ogg Theora, change the size of video files, add extra audio tracks etc etc etc

It is a command line application, this means there is no graphic user interface ('GUI'), and you have tell ffmpeg2theora what to do through the use of commands. On Linux you would use a 'shell' like so:

shell

On Windows the command line looks like this:

Running an application like this on the command line gets some getting used to, but in the long run, if you persevere, it becomes easier to do and quicker. You can also quickly cut and paste commands to do very powerful things without the need to endlessly figure out where the settings are kept in graphical interfaces.

You may ask why it's relevant to encode media to Ogg Theora rather than more common video file formats like MP4. You might not have known but the format of video files is often owned by companies - this can sometimes lead to problems. If, for example,  users only use proprietary video file formats like MP4 then the future for video applications is quite dark. While end users don't have to pay to use MP4 technology, the software creators do. This means that by only encoding to commercial, closed formats you are limiting the possibilities of using free, accessible tools in the future.

Currently it's common to encode to the flv (flash) file format to embed video in webpages. Flash is owned by Adobe. However it is possible to embed Ogg files in internet pages just as easily. To give Web developers the encouragement to do this we should make our video content available in the Ogg Theora format.

Installing on Windows

FFMPEG2Theora is a command line application. This means it has no grahic user interface (GUI) and it must be operated through the command line.  If you are not used to using command line applications they can be a bit confusing. If you follow these instructions hopefully they will take some of the confusion out of the process.

Before downloading it's a good idea to create the directory for the application to be stored in. Open Windows explorer and make sure the folder button on the menu is pressed down. Select the (C:) Drive.

ffmpeg2theora_7 

Select File > New > Folder 

ffmpeg2theora_8

Enter ffmpeg2theora as the folder name. Press 'Enter' when you have typed that.

Then point your browser at the ffmpeg2theora website - http://v2v.cc/~j/ffmpeg2theora/download.html

Right hand click on the 'Windows' link. Select 'Save Link as...' (see below) :

ffmpeg2theora_1 

Save it to your hard drive in the new directory,  'C:\mpeg2theora'

When the file is saved use Windows Explorer to look inside that directory. You will see that it is called something like ffmpeg2theora-0.20.exe.

Rename the file to ffmpeg2theora.exe - this will make the software easier to use when we start to use it.

 To rename the file  right click on the file name in Window Exporer, Select and click 'Rename'

ffmpeg2theora_9

Then type the new name 'ffmpeg2theora.exe' 

ffmpeg2theora_10

Then press 'Enter'

You are now ready to start to use the software.

Installing on Ubuntu

Software name : ffmpeg2theora
Homepage : http://v2v.cc/~j/ffmpeg2theora/
Software version used for this installation :0.2
Operating System use for this installation : Ubuntu 7.10
Recommended Hardware : 300MHz  CPU 

Installing ffmpeg2theora on Ubuntu is pretty straight forward. You first need to know a little about the Synaptic Package Manager, if you already know about it you can skip right to the bottom of the page.

Synaptic Package Manager

The Synaptic Package Manager (SPM) is used for more than just installing software. It can also upgrade your entire operating system, and manage all software installed on your computer. However most people use SPM for just installing new software. Before you embark on this process there are a few concepts that you may wish to get familiar with. Its not crucial you understand them throughly, so just read the explanations and then let it soak in over time. The ideas behind SPM will become clearer with use.

What is a repository?

SPM can automate the installation of software on your computer because it has a direct connection to one or more online software repositories. These repositories are vast archives of softwares that have been pre-configured for installation on your operating system . When your computer is online SPM can connect to these archives, check what software is available for installation, and present you with a list of installable software. All you have to do is select the software from the list that you want. SPM then downloads the software from the repository and takes care of the installation process.

So SPM is actually a repository manager, it manages which repositories (there are many) you wish to access, and which softwares to download and install from those repositories.

SPM allows you to choose which repositories it accesses through its settings. The default repositories used by Ubuntu can be extended through the SPM settings so you can access a wider range of softwares. Ubuntu calls each repository by a simple name. They are : Main, Universe, Multiverse, Restricted. By default Ubuntu only uses the Main online repository. If you wish to access you the other repositories you must do this by changing repository settings of SPM.

What is a package?

When SPM downloads a software for installation it is in the form known as a 'package'. This means that it is a compressed archive of the software, pre-configured so that it will install nicely on your computer. If the package has been configured nicely, and Ubuntu spends a lot of time making sure this is the case, then many of the headaches that installing software can bring are taken away - its the panadol of software installation.  One of the biggest issues with installing software on any form of Linux (Ubuntu is one of many types of Linux), are dependencies. Dependencies are all the other softwares required by a particular software. If, for example, I want to install a audio editor, that audio editor software may use some functionality of other softwares to do its job.

SPM takes the (often) dark art of dependencies away from you, and manages this itself. So if you wish to install a software and it has dependencies (and the list can be long), you don't have to work this out yourself, SPM knows already what is needed, finds it, and installs it along with the software you have chosen.

So, SPM, as well as managing which repositories you access, is also a package management software. Hence the name - Synaptic Package Manager.

apt

You don't really need to know about apt, so if you are on the verge of being confused then don't read this short section. If you are a geek wannabe then read on.

Ubuntu is a form of Linux that has derived from another form of Linux - Debian. This family of Linux has in common (amongst other things) the package/repository management system. Both Ubuntu and Debian use the apt system for managing packages. APT is actually an acronym short for Advanced Package Tool.

SPM is actually a 'front end' (graphical interface) for controlling apt. So SPM is the nice user interface that you see, but the real work is done by apt. There are other ways of managing apt also, such as the command line interface known as apt-get. In the world of Linux there are many varieties of Linux users and they have their own ways of doing things. In general its safe to say most Debian users use apt-get, and most Ubuntu users are happier using SPM.

Configuring Synaptic Package Manager 

To install most software on Ubuntu you will need to change the default repository settings of SPM as many softwares are not contained in the default repository. To do this you will need to open the Synaptic Package Manager and you can do this via the System menu. If you haven't changed the default Desktop of Ubuntu then the System menu can be accessed at the top left of your screen:

spm.jpg 

If all is good you will be prompted for a password.

pass.jpg

Here you must enter your password (the same one you use to log into the system). If you don't know the password then you have a problem and its probably caused by the fact that the computer you are using is not yours. In this case you have to find the computers owner and ask them for the password (which is usually not polite unless you know them well) or ask them to input the password while you look casually in the other direction.

Assuming the password entered is correct - you will now see the SPM open infront of you. It may be that you first see the following 'Quick Introduction' (this appears if you haven't used SPM before).

splash.jpg

Just click Close and move on. Lets look at the Synaptic Package Manager interface...

spm1_1.jpg

Lets not worry about the details of the interface for now. All we want to do is change the repository settings. To do this click on the Settings and choose Repositories

settings.jpg 

Now we get to where we can do some business. Make sure that all the options are checked :

repositories2
 

Now close that window by pressing the big close button at the bottom right.

close.jpg

Next, you will see a warning telling you the repository has changed :

repositorychanged.jpg

Click the Close button and move on to SPM so you can refresh the repositories as the warning suggests. To do this, do as the warning says - click on Reload :

reload.jpg

You should then get some feedback saying the repositories are being updated and showing the progress. 

spmprogress.jpg 


Choosing ffmpeg2theora to Install

The rest is easy.

Now that you have Synaptic configured you can use it to install ffmpeg2theora. To do this click on the Search button in the Synaptic Package Manager interface. The search button looks something like this :

search

when you click on this button you see something like this:

search2

Now type in 'ffmpeg2theora' :

search

Now press 'Search' and in a few moments you should see this:

synfound

Now we double click on the little box you can see in the above window which lies to the right of the text 'ffmpeg2theora'. When you do this another pop-up appears:

mark

When you select this option you will see this:

marked 

Now you can click on 'Apply':

apply 

Now you will be shown a window asking for your confirmation :

confirm

Press 'Apply' once again and the installation process starts:

progress 

When it is finished you will see a confirmation window:

done

You can press close, now ffmpeg2theora is ready to use... remember, ffmpeg2theora is a command line application and has no graphic interface.

Basic Encoding settings 

The basic format to encode an ogg file on the command line is shown below :

ffmpeg2theora -o video_output.ogg video_source.avi

The '-o' option allows you to specify the output file name.

You can use the '-v' and '-a' parameters to control video and audio quality. The defaults (5 and 2) should be fine for average quality requirements. With '-v 7', we already get very good video quality, but the output file size is roughly double. As far as audio quality is concerned, keep in mind the source quality. Unless your audio input is high quality (audio in directly connected to the conference room sound system), there is no need for high bitrate audio compression ('-a' setting greater than 4).

ffmpeg2theora -v 7 -a 3 -o video_output.ogg video_source.avi

Deinterlacing?

If the output video quality is poor, it could be because your video needs deinterlacing.  Interlaced video is very easy to identify. You just need to find a sequence with motion (camcorder or character motion), pause the video and interlaced lines will show up. You can clearly see interlaced lines in this still image :

interlaced
 

So, if you source video is interlaced, use the '--deinterlace' parameter of ffmpeg2theora:

ffmpeg2theora --deinterlace -o video.ogg video.dv

Ogg/Theora video with metatags

It's possible and useful to add meta-information. Meta-information is text information about your video, it may include the title, author, location, and license of the ogg video file.

This information can be added thanks to ffmpeg2theora parameters:

ffmpeg2theora -a 3 -v 6 --artist "Mel G" --title "Squat the Lot"
--date "October 1995" --location "Brighton,UK"
--organization "Undercurrents.org"
--copyright "Copyright 1995, Mel G"
--license "Creative Commons Attribution-ShareAlike 2.5"
-o squat_lot_uk_undercurrents_1995.ogg video_source.avi

Using on Windows

If you are really struggling using the Command line in Windows to run ffmpeg2theora, there is an alternative. There is a front end GUI which has buttons you can click and boxes to tick. It's called Super Encoder the help file is here Create Ogg Theora files in Super. However, if you follow the instructions below you'll be able to access all the tools more efficiently.

To use the Command Line in windows, click on the 'Start' button at the bottom left of your screen and select the 'Run' option.

ffmpeg2theora_2 

Then type 'cmd' into the box that appears.

ffmpeg2theora_3 

You should the see a black box appear. You are now living on the command line! There is what is called a prompt line with a flashing cursor. The prompt line tells you what directory you are in.

ffmpeg2theora_4 

Firstly we need to change directory to the 'c:/ffmpeg2theora' directory. It is presumed that this is the directory that you saved the ffmpeg2theora.exe file to.

To do this you go up a couple of directories by entering the text 'cd ..' and then pressing 'Enter'. Repeat this until the prompt line reads 'C:'

ffmpeg2theora_5­

Then change directory to the one where the ffmpeg2theora exe files are. In this case. Enter :

cd ffmpeg2theora

We can then enter commands to encode video files.

To get your source file ready to encode the easiest way to do it is to move it into the 'C:/ffmpeg2theora' directory.

If we imagine the source is called 'source_test.avi' a simple way of creating an ogg file would be to enter the following command:

ffmpeg2theora -o target_test.ogg source_test.dv.

Advanced Encoding Commands

Pipe DV files: 

  cat something.dv | ffmpeg2theora -f dv -o output.ogg -

Live encoding from a DV camcorder (needs a fast machine): 

  dvgrab - | ffmpeg2theora -f dv -x 352 -y 288 -o output.ogg -

Live encoding and streaming to icecast server: 

  dvgrab --format raw - | \n   ffmpeg2theora -f dv -x 160 -y 128 -o /dev/stdout - | \n   oggfwd iccast2server 8000 password /theora.ogg

Streaming Video with FFMPEG2Theora

This method focuses on streaming video from a DV or Firewire camera using Linux. The video stream will be Ogg Theora which means your users will be able to watch using Theora enabled player or in a java applet such as Cortado.

There are two ways of doing this. The hard way and the easy way. The hard way is to do everything by hand (installing everything from source). In fact when I wrote this document originally, that was the only way to do it. However things have progressed and now there is an easier way. The easy way is to use Debian (or maybe Ubuntu, I haven't tested this) and use the Debian Packages.

In case you can't use Debian or you want to make your life hard for no good reason, then I have included this process as well. To go this route it will help to be familiar with Linux. In fact, don't go much further unless down the hard road unless you know how to find your way around Linux and you should also know a little about modules, compiling software from the command line, and using a command line interface for executing software. Following this process as a 'newbie' could be tricky. I provide as much information about the process as I can but there are a lot of issues that you may need to resolve that I cannot account for here. Certainly as a 'moderately' experienced Linux user you should be ok. 

Getting Ready

  • A Firewire camera is not the same as a DV camera. However for the intents of this manual they work the same.
  • Firewire is known also as ieee1394

Requirements

You will need the following:
  • DV cam
  • 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)

In addition to the above you need to have raw1394 support for your firewire devices. raw1394 is a kernel module. A kernel module is a small extension to the operating system that enables specific functionality that is not included in the kernel itself. Kernel modules work similar to plugins in other applications, except they extend the functionality of the entire operating system not just a single application.

You may not have raw1394 support. To check if you do open a terminal and type the following:

lsmod

You may see a long list of items similar (but not exactly the same) to this:

Module                  Size  Used by
md5                     7680  1
ipv6                  234784  12
lp                     13448  0
via_agp                11264  0
sworks_agp             10912  0
sis_agp                 9988  0
nvidia_agp              9756  0
intel_mch_agp          11792  0
efficeon_agp           10144  0
ati_agp                10380  0
amd64_agp              13640  0
amd_k7_agp              9740  0
ali_agp                 9216  0
autofs4                18820  1
af_packet              20104  0
i810_audio             36884  1
soundcore              11104  2 i810_audio
ac97_codec             20108  1 i810_audio

Look in this list for raw1394. If you see it then great! If not then type this:

modprobe raw1394

Then retype lsmod and you may see something like this:

Module                  Size  Used by
raw1394                28396  0
md5                     7680  1
ipv6                  234784  12
lp                     13448  0
via_agp                11264  0
sworks_agp             10912  0
sis_agp                 9988  0
nvidia_agp              9756  0
intel_mch_agp          11792  0
efficeon_agp           10144  0
ati_agp                10380  0
amd64_agp              13640  0
amd_k7_agp              9740  0
ali_agp                 9216  0
autofs4                18820  1
af_packet              20104  0
i810_audio             36884  1
soundcore              11104  2 i810_audio
ac97_codec             20108  1 i810_audio

The first line says raw1394 28396 0 which is good news. If you see something similar to this then this is also good! You can also try checking dmesg (just type dmesg on the command line and look for something signifying the raw1394 module is ok - if you see nothing mentioned then chances are raw1394 is not installed). Otherwise you are going to have to take the long road home and get raw1394 support in your kernel modules. This can be complicated as it depends on what version your kernel is etc etc. A good starting point for this research would be here:

http://www.linux1394.org/

Set-Up

Assuming you have the raw1394 module running, lets start setting up the software you need. We will need to install the following applications:

  • dvgrap
  • ffmpeg2theora
  • oggfwd.

The Easy Road 

With Debian 4 you can run this command line (using stable sources):

apt-get install libshout3 libshout3-dev dvgrab ffmpeg libtheora0 libtheora-dev oggfwd 
ffmpeg2theora 

The above command should all appear on one line. Now, with luck you have everything you need to get started. So first we need to plug in the dv (or (firewire) camera 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. Check the raw1393 module is loaded by using lsmod (see the section near the beginning of this document on raw1394).

ok, so the thing is you will need know is to execute the following line on one command line. You will need to use the streaming server details you have for the Icecast2 (theora-enabled) server. The command is:

dvgrab --format raw - | ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o /dev/stdout - | 

oggfwd  icecastserver  8000 pwd /theora.ogg

Remember the command will have to be all on one line (the above example is not). Also replace the details:

  • icecastserver
  • 8000
  • pwd

with the details you have from your Icecast server. 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.ogg with anything as long as it starts with a forward slash (/) and ends in .ogg.

Now, you should be streaming! To check the connection use VLC .

The Hard Road 

You might want to cancel your appointments for the day.... 

dvgrab

You can find the source code and installation packages for dvgrab here - http://www.kinodv.org/

There are a number of ways to install software on Linux. The method very much depends on the tpe of Linux you are running. I am going to go through the following methods as they are the most popular:

* installing dvgrab with Debian (also true for Ubuntu and Knoppix)
* installing for Gentoo
* installing for Redhat
* installing by source

Installing dvgrab on Debian

Installing dvgrab on Debian based systems should be quite easy. Debian has a package management application called apt. The process for installing software in debian usually follows this process using apt (you usually have to be online for this) :

step 1 - Type the following into the command line (terminal):

apt-cache search dvgrab

You will hopefully see something like this in the terminal window:

dvgrab - grab digital video data via IEEE1394 links

The command apt-cache search dvgrab looks for applications online in the Debian repositories (places where software is stored) and if it finds one with a name matching dvgrab then it lists those applications. To get familiar with how this works try the same command (apt-cache search) with different application names eg. apt-cache search mozilla

So, the output in the terminal window will either return nothing (a blank line) or some output such as that illustrated above. The above output gives the name of the application that matches your search (in this case dvgrab) and a short description ("grab digital video data via IEEE1394 links").

Now, if you see this then this is good news. The application is available from the repositories and we can install it. If the returned output was a blank line it means the repositories listed don't contain the software you are after, in which case you can do one of two things:

  • install by source (see details below)
  • learn about apt and alter the sources.list to include a repositry with your software. This can be tricky but its good to know. To start your research read this:
http://www.debian.org/doc/manuals/apt-howto/index.en.html

step 2 - So, assuming the repositry has dvgrab you need to install the software. Under Debian this is very easy, however you may have to (depending on how your operating system is set up) use the sudo or su commands for step2. This is because your user account may not allow you to install software but it will have to be done by root. I will explain this more below, in the meantime lets first look at the basic commands:

apt-get install dvgrab

This should download the required packages and install. The process may ask for some feedback (it may ask you to verify its the right package etc) in which case you should read the messages in the terminal window carefully before deciding. If all is well, you will then have installed dvgrab.

To test if dvgrab is installed type this in the terminal:

dvgrab --version

You will hopefully get an output similar to this:

dvgrab 1.8

This means you have dvgrab version 1.8 installed (your output might contain a different version number).

If you can't get the software installed via apt-get it might be because your user account does not have permission to install software. In which case you will need to use the su or sudo commands. These allow you to install software as the root user. su will log you in as the root user and then you can execute any commands you like under root. Be careful if you choose this way as you can accidently do a lot of damage to your operating system if you carelessly type the wrong command as root. To use su just type the command in the terminal and hit return. Then you will be prompted for the root password. if you do not know the root password for your system then you cannot use this method unless the system administrator sets it up for you. Once you have entered the root password you can follow the install steps above and all should be ok.

The other process to consider using is with sudo. sudo is short for super-user-do. So any command entered after sudo will be executed as root (superuser). So, type this:

sudo apt-get install dvgrab

You will then be prompted for a password. Enter your user account password not the root password. Then, if all is well, apt will install dvgrab. If all is not well and you get a permission error then you need to contact the system administrator and ask them if they will give you permission to use sudo (they do this by altering the sudoers file which is found at /etc/sudoers , for more info on this see http://www.courtesan.com/sudo/man/sudoers.html )

Installing dvgrab on Gentoo

Gentoo is another variety of Linux and it has its own package manager called emerge. The emerge system is pretty easy to use also and it usually contains more up-to-date versions of the software that Debian. To check if a package is available in emerge you should go to the Gentoo Online Package Management Database ( http://packages.gentoo.org/ ) and on the left you will see a search form. Enter dvgrab in the form field and click the "search" button (or press return).

Hopefully, you will get a page explaining to you some details of the dvgrab package for emerge. Now, to install type:

emerge dvgrab

You may have to use su or sudo to do this (see notes above in FFmpeg2Theora.Installing under Debian). Now test by typing :

dvgrab --version

Installing dvgrab on Redhat

I'm not so experienced on Redhat so if there are any Redhat gurus reading this I would appreciate any help in providing better information for using rpm to install dvgrab.

To install you need to use the Redhat Package Manager which is also known as rpm. To find package for Redhat you need to go online with a browser and look for a package database. rpmfind is a good one:

http://rpmfind.net/

There is a search form on this page that you should enter dvgrab and press return. You will be presented with a list of files that relate to your search term.Scroll down the page and find the package that suits the hardware of your machine. If you have a Pentium processor choose a version with 386 in its name. If you dont know the type of hardware you have then try 386 or try installing from source (see below). The example file I will use is dvgrab-1.7-3.i386.rpm

Now download the file. To install the downloaded file, type the following (make sure your terminal is in the same directory as the downloaded file):

rpm -i dvgrab-1.7-3.i386.rpm

Now the install process should just run its course. To test the install try this in the terminal:

dvgrab --verbatim

and refer to the notes on testing in the above sections.

Installing dvgrab from source

This is always the fallback method for installing if all else goes horribly wrong.

To install from source first you need to download the latest sources. Open this page in your browser: http://www.kinodv.org/

Then goto the dvgrab download section and download the latest sources. In this case the latest source file is dvgrab-1.8.tar.gz.

Now, in a terminal (ensuring you are in the same directory as the downloaded sources) type the following:

tar zxvf dvgrab-1.8.tar.gz

Remember to replace dvgrab-1.8.tar.gz with the name of your downloaded file.

This command decompresses the archive file and creates a new directory with the source files in it. You will now have to change directories and go into the newly created directory. In a terminal type:

cd dvgrab-1.8

Remember your new directory might be called something other than dvgrab-1.8 , to check type ls in the terminal and you will see a list of files and directories. From this you can see the right name of the new directory.

Now type:

./configure

If all is good, you can then type:

make ; make install;

and the software will be installed. However probably you have this error:

configure: error: avc1394.h not found, install libavc1394-devel

If you get this it means one of the dependencies hasn't been met. So you have to install this libavc1394-devel. Usually what I do in this situation is google for the lost package. If we do this, the first link is to this page: http://sourceforge.net/projects/libavc1394/

This is the homepage for the libavc1394 software. At the time of writing the latest version is libavc1394-0.5.1 . Download this file and decompress the file like so (make sure your terminal is in the right directory):

tar zxvf libavc1394-0.5.1.tar gz

The change directories to the newly created source directory:

cd libavc1394-0.5.1 

then do the configure:

./configure

then type the make and make install as so:

make ; make install;

You may need to use su or sudo to do this (see above sections). Now change back to the dvgrab source directory and do a configure again:

./configure

Then all should be good (no error messages) and so do the following:

make ; make install;

(you may need to use su or sudo for this too. Thats it! Now test with:

dvgrab --version

notes

  • if you would like to know more about dvgrab visit the developers website:
http://www.kinodv.org/
  • if you wish to read the manual that was installed with dvgrab the use the man command like so:
man dvgrab

oggfwd

http://www.v2v.cc/~j/ffmpeg2theora/oggfwd/

There are two ways of installing oggfwd, from source of by downloading a pre-compiled binary. The first way is similar to the process we went through with dvgrab, the second (installing the binary) means that you simply download the application and run it without any need to install. If you are a Debian user you can use :

apt-get install oggfwd 

First however you need to install a libshout-2.1 which is a library of code that oggfwd uses. To install libshout-2.1 first download it from here (Debian users could first try apt-get install libshout3-dev):
http://v2v.cc/~j/ffmpeg2theora/oggfwd/libshout-2.1+svn.tar.gz

Download this and decompress using the following:

tar zxvf libshout-2.1+svn.tar.gz

Now change directories to the newly created directory:

cd libshout-2.1

and run the configure script:

./configure

If all is well do a make and make install (it may need to be done using su or sudo, check the notes above for dvgrab).

make ; make install;  

Installing Oggfwd from source

First download the file oggfwd.tar.gz and then decompress it using the terminal command:
tar zxvf oggfwd.tar.gz

Then change directories to the newly created directory

cd oggfwd

Now compile the binary

make

Now install the compiled binary

make install

This last step may need to be done using su or sudo (see the dvgrab section above).

To test if it is installed type

oggfwd

and you should see an output in the terminal like:

usage: oggfwd hostname port# password target
sample: oggfwd icf.de 8100 abc123 /cast.ogg 

Using the Oggfwd pre-compiled binary

To use the pre-compiled binary simply download the file oggfwd.linux.bin and execute it like so:
./oggfwd.linux.bin

and you should see something like this:

usage: oggfwd hostname port# password target
sample: oggfwd icf.de 8100 abc123 /cast.ogg

Now, to use oggfwd.linux.bin you need to change its permissions, copy it to the directory that contains all your other binaries, and change its name to oggfwd.

Change the permissions and move it to /usr/bin (renaomg it to oggfwd at the same time):

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

Now, if you simply type oggfwd the application should start and give the same output in the terminal as described above.

ffmpeg2theora

ffmpeg2theora requires two applications to be installed before you can install it. They are ffmpeg and libtheora. It has to be said that installing ffmpeg can be complex because it has so many compile options. We will go through the process with just some simple options enabled, you may wish to re-install it with more complex choices at another date.

ffmpeg

You must install the latest version of ffmpeg from the development site http://ffmpeg.sourceforge.net/index.php

If you know how to use CVS then you can check out the CVS files and use them to build ffmpeg . If you don't know how to use CVS then I have downloaded the files for you from CVS and you can find them here: http://www.xs4all.nl/~adam/source/ffmpeg_101205.tar.gz

When the file is downloaded, decompress the file with the following command:

tar zxvf ffmpeg-0.4.9-pre1.tar.gz

Remember to replace ffmpeg-0.4.9-pre1.tar.gz with the actual name of your file.

Next, change directories to the source directory:

cd ffmpeg-0.4.9-pre1.tar.gz

You directory may be named slightly differently from the above example. Now, we need to do a configure but with a parameter included in the command, this is to enable ogg vorbis support.

./configure --enable-vorbis

Now do a make and make install (may need to be done using su or sudo, see the notes above for isntalling dvgrab).

make ; make install;

It might take a long time to compile and install.

To test it all went well type this:

ffmpeg -v

You should see an output in the terminal similar to this:

ffmpeg version 0.4.9-pre1, build 4718, Copyright (c) 2000-2004 Fabrice Bellard
  built on Sep  6 2005 23:39:39, gcc: 3.3.6 (Debian 1:3.3.6-7)

libtheora

Theora is the codec you need to stream, in other words its the format of the streamed video. To use theora you need to install the libraries that enable it. I think it is best to install the latest one from source, so we will only look at this method. You may wish to try other ways for Debian, Gentoo etc. It is also worth noting that you could try installing libtheora-mmx instead off libtheora as it is faster. According to the oggfwd and ffmpeg2theorammx version is 2-3 times quicker. If you want to try this you can follow the below steps, but instead of using the sources from http://www.theora.org you could try : http://downloads.xiph.org/releases/theora/libtheora-mmx-1.0alpha5.tar.bz2

If you wish to try the 'plain vanilla' sources get them from : http://www.theora.org/

At the time of writing the latest source file is libtheora-1.0alpha5.tar.gz, so we will download this and decompress like so:

tar zxvf  libtheora-1.0alpha5.tar.gz 

Now change directory to the new source directory:

cd libtheora-1.0alpha5

Try running the configure script:

./configure

Now do a make and make install. It might need su or sudo (see above in dvgrab section).

make ; make install;

Hopefully all is well, and we can continue with installing ffmpeg2theora.
 

ffmpeg2theora

Download the package from here (we will only install from source): http://www.v2v.cc/~j/ffmpeg2theora/download.html

The file I am working with is ffmpeg2theora-0.15.tar.bz2, to decpmpress this try this command:

tar xvfj ffmpeg2theora-0.15.tar.bz2

Now change directories to the new source directory:

cd ffmpeg2theora-0.15

Now try the configure process

./configure

Then a make and make install:

make ; make install;

phew.....hopefully your are now done, to test ffmpeg2theora try this:

ffmpeg2theora

and you should see a lot of information appear on how to use the application, the output should be similar to this:

ffmpeg2theora 0.13

usage: ffmpeg2theora [options] input

Output options:
--output,-o alternative output
--width, -x scale to given size
--height,-y scale to given size
--aspect define frame aspect ratio: i.e. 4:3 or 16:9
--crop[top|bottom|left|right] crop input before resizing
--videoquality,-v [0 to 10] encoding quality for video
--videobitrate,-V [45 to 2000] encoding bitrate for video
--sharpness,-S [0 to 2] sharpness of images(default 2)
{ lower values make the video sharper. }
--keyint,-K [8 to 65536] keyframe interval (default: 64)
--audioquality,-a [-1 to 10] encoding quality for audio
--audiobitrate,-A [45 to 2000] encoding bitrate for audio
--samplerate,-H set output samplerate in Hz
--channels,-c set number of output sound channels
--nosound disable the sound from input
--endtime,-e end encoding at this time (in sec)
--starttime,-s start encoding at this time (in sec)
--v2v-prwww-data,-p encode file with v2v preset,
right now there is preview and pro,
'ffmpeg2theora -p info' for more informations

Input options:
--deinterlace,-d force deinterlace,
n otherwise only interlaced material is deinterlaced
--format,-f specify input format
--inputfps [fps] override input fps

Metadata options:
--artist Name of artist (director)
--title Title
--date Date
--location Location
--organization Name of organization (studio)
--copyright Copyright
--license Licence

Other options:
--nice set niceness to n
--debug output some more information during encoding
--help,-h this message

Examples:
ffmpeg2theora videoclip.avi (will write output to videoclip.avi.ogg)

cat something.dv | ffmpeg2theora -f dv -o output.ogg -

Live encoding from a DV camcorder (needs a fast machine)
dvgrab - | ffmpeg2theora -f dv -x 352 -y 288 -o output.ogg -

Live encoding and streaming to icecast server:
dvgrab --format raw - | \
ffmpeg2theora -f dv -x 160 -y 128 -o /dev/stdout - | \
oggfwd iccast2server 8000 password /theora.ogg
 

Plugging in

Now, with luck you have everything you need to get started. So first we need to plug in the dv (or (firewire) camera 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. Check the raw1393 module is loaded by using lsmod (see the section near the beginning of this document on raw1394).

ok, so the thing is you will need know is to execute the following line on one command line. You will need to use the streaming server details you have for the Icecast2 (theora-enabled) server. The command is:

dvgrab --format raw - | ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o /dev/stdout - | 

oggfwd  icecastserver  8000 pwd /theora.ogg

Remember the command will have to be all on one line (the above example is not). Also replace the details:

  • icecastserver
  • 8000
  • pwd

with the details you have from your Icecast server. 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.ogg with anything as long as it starts with a forward slash (/) and ends in .ogg.

Now, you should be streaming! To check the connection use VLC .


License

All chapters copyright of the authors (see below). Unless otherwise stated all chapters in this manual licensed with GNU General Public License version 2

This documentation is free documentation; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this documentation; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Authors

COMMANDS
© Michael Opdenacker 2007
Modifications:
adam hyde 2007
Jan Gerber 2007

BASIC ENCODING
© Michael Opdenacker 2007
Modifications:
adam hyde 2007
Jan Gerber 2007
mick fuzz 2007

CREDITS
© adam hyde 2007
UBUNTU
© adam hyde 2007
WINDOWS
© mick fuzz 2007
Modifications:
adam hyde 2007

INTRODUCTION
© adam hyde 2006, 2007
Modifications:
mick fuzz 2007

STREAMING DV
© TWikiGuest 1970
WINDOWS BASICS
© adam hyde 2007
Modifications:
mick fuzz 2007

 

100.gif

Free manuals for free software

 

 

General Public License

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:


a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.


b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:


a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,


b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS