Monday, March 23, 2009

ffmpeg live stream to ffserver

I finally got this to work!! Here is how I did it.

Hardware: HP a1140n with firewire 6-pin and Canon zr45 with 4-pin firewire. I have everything hooked up and running Ubuntu 8.10.

Software: ffmpeg, ffserver config file, dvconnect, DV Live capture instructions

Once you have everything in place and you tested the live capture of the video then you can continue. Remember that you need to either have a tape playing in the camera or have the camera turned on to start recording for dvconnect to work. I ran through all of the examples first and made sure I could grab the video, transcode the videos to flash before I got this all to work properly.

ffserver.conf [CHANGES]:

Note that you may experience problem with the config file and the output, fear not we will get through this. I commented out the MPG streaming and will eventually give you a great mp4 config as I am still working on it. Below is the FLV code I got working and you can change the information as you see fit for the bit rates etc. Again I commented out all of the mpg stuff in the conf file.
# FLV streaming

<Stream output.flv>
Feed feed1.ffm
VideoBitRate 1024
VideoBufferSize 128
Format flv
VideoSize 352x288
VideoFrameRate 24
VideoQMin  3
VideoQMax  3
You can add it right after the sample scripts that is where I added it. In terminal start up the ffserver under root:
Now for the following terminal scripts I opened 2 windows and logged in as root [su]

Terminal Window (1) - dvconnect (You should have followed the direction above and tested this already)
dvconnect -- >/tmp/fifo.rawdv
NOTE: it looks like the terminal window has been stuck but it is not, it is waiting on the video stream. Might want to have the video camera on or video running before you issue this command. Trial and error.

Terminal Window (2) - Sending the video to ffserver
ffmpeg -f dv -i /tmp/fifo.rawdv http://localhost:8090/feed1.ffm
NOTE: if you have problem with this command then either the video is not running or something weird might have happened, look at the terminal window (1) and see if it kicked out, it has to be running in order to capture the video to FIFO.

Now with your browser you should be able to see if everything is running from ffserver http://localhost:8090/stat.html. From this page you should see that a stream is waiting on someone to connect.

Watching the video from FLV in a website. I suggest you get the flowplayer from It is the best in my opinion. They have a sample page that you can hook up your FLV from this ffserver to the flowplayer and watch the live stream. Good luck.

No comments:

Post a Comment

Raspberry Pi Zero W - Wireless Configuation

create the file under "boot" folder wpa_supplicant.conf country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev u...