Differences between revisions 10 and 11
Revision 10 as of 2010-06-16 06:57:59
Size: 2574
Editor: asbesto
Comment:
Revision 11 as of 2010-06-18 09:15:01
Size: 3244
Editor: asbesto
Comment:
Deletions are marked like this. Additions are marked like this.
Line 46: Line 46:
Line 48: Line 49:
VideoFrameRate 10
VideoBufferSize 80000
VideoBitRate 30
VideoQMin 1
VideoQMax 5

# Audio bit rate at 16 instead of 44 reduces bandwidth a lot! ;)
AudioBitRate 16
# idem for sample rate
AudioSampleRate 22050

# Bitrate for the video stream: QUADRATAZZI
VideoBitRate 90

# Ratecontrol buffer size, non esagerare, meno e' meglio (?!?)
VideoBufferSize 1000

# Number of frames per second: SCATTICAZZI
VideoFrameRate 3

#VideoQMin 1
#VideoQMax 5
Line 54: Line 68:
PreRoll 0
#
#Noaudio
#
PreRoll 15

#Noaudio this if you want video only
Line 59: Line 73:
Line 61: Line 76:
To get things going, start the server
 

Using the above settings, quality is sufficient, framerate is 3 per second, sufficient for basic usage, and the used bandwidth is around 10Kb/s !!! :)

So, just launch the server:
Line 77: Line 94:
ffmpeg -f oss -i /dev/dsp -r 6 -s 352x288 -f video4linux2 -i /dev/video0 http://10.10.10.160:8090/feed1.ffm ffmpeg -f oss -i /dev/dsp -r 3 -s 352x288 -f video4linux2 -i /dev/video0 http://10.10.10.160:8090/feed1.ffm
Line 88: Line 105:
I don't understand:

 * how the -r parameter of ffmpeg interact with server, and
 * why audio and video goes out of sync. (this problem is also described in ffserver docs)
Line 93: Line 115:
The name of the file will be as defined in the <Stream> section above. The name of the file (test.swf) was defined in the <Stream> section above.
Line 98: Line 120:
<br><br><center>

Video Streaming Howto

by asbesto & geenna, Poetry Hacklab, 15/06/2010

Using ffmpeg & ffserver

We want to use a web camera to stream video to web page using ffserver. ffserver is part of the ffmpeg package.

apt-get -y install ffmpeg

ffserver creates a network socket that is available from client machines to view the video. Once started, you attach an ffmpeg process to the server to do the encoding. Configuration of ffserver is done via the /etc/ffserver.conf file.

We installed ffserver on a machine at ip address 10.10.10.160. Typical ffserver.conf file:

Port 8090 
# bind to all IPs aliased or not 
BindAddress 0.0.0.0 
# max number of simultaneous clients 
MaxClients 1000 
# max bandwidth per-client (kb/s) 
MaxBandwidth 10000 
# Suppress that if you want to launch ffserver as a daemon. 
NoDaemon 

<Feed feed1.ffm> 
File /tmp/feed1.ffm 
FileMaxSize 800M 
</Feed> 

<Stream status.html>
 Format status
</Stream>

<Stream test.swf>
Feed feed1.ffm

Format swf
VideoCodec flv

# Audio bit rate at 16 instead of 44 reduces bandwidth a lot! ;)
AudioBitRate 16
# idem for sample rate
AudioSampleRate 22050

# Bitrate for the video stream: QUADRATAZZI
VideoBitRate 90

# Ratecontrol buffer size, non esagerare, meno e' meglio (?!?)
VideoBufferSize 1000

# Number of frames per second: SCATTICAZZI
VideoFrameRate 3

#VideoQMin 1
#VideoQMax 5

VideoSize 352x288
PreRoll 15

#Noaudio this if you want video only

</Stream>

Using the above settings, quality is sufficient, framerate is 3 per second, sufficient for basic usage, and the used bandwidth is around 10Kb/s !!! :)

So, just launch the server:

ffserver &

Attach the ffmpeg process to do the encoding. This is done via a loopback socket.

#
# this is without audio
#
ffmpeg -r 3 -s 352x288 -f video4linux2 -i /dev/video0 http://10.10.10.160:8090/feed1.ffm
#
#This is WITH EMBEDDED AUDIO!!!
#
ffmpeg -f oss -i /dev/dsp -r 3 -s 352x288 -f video4linux2 -i /dev/video0 http://10.10.10.160:8090/feed1.ffm

Parameters are

  • -r rate in frames per second
  • -s size in pixels width x height (width must be a multiple of 16) and should match the values in the above config file.
  • -f gets input from the video4linux driver
  • -i is the v4l device (if this is not present refer to Logitech QuickCam Express)

  • Lastly the loopback socket

I don't understand:

  • how the -r parameter of ffmpeg interact with server, and
  • why audio and video goes out of sync. (this problem is also described in ffserver docs)

Now you should be able to browse to the server address (or localhost if it's the same machine) and see some live video and the status page.

The name of the file (test.swf) was defined in the <Stream> section above.

A simple source for a basic webpage with embedded video is here:

<html>
<br><br><center>
<embed src=http://10.10.10.160:8090/test.swf height=128 width=160> </embed>
</html>

Video Streaming using FreeJ

Please read FreejStreaming for this. Only OGG/Theora!

VideoStreamingHowto (last edited 2010-06-18 09:19:27 by asbesto)