[theora] Webcam streaming with ptalarbvorm

Basil Mohamed Gohar abu_hurayrah at hidayahonline.org
Thu Apr 15 10:56:42 PDT 2010


Hey all!  I'm sure you've all been missing my webcam stream, so I
decided to start it up again (also, I wanted to do it for my family
overseas).

However, this time, I'm doing things a little bit differently.  For
starters, the encoder is the current (as of about an hour ago)
ptalarbvorm branch which is destined to become libtheora 1.2.  Another
difference is that I'm using gstreamer (via gst-launch) to handle every
aspect of the webcam streaming, from capturing through to streaming. 
The command for that is as follows:

time gst-launch-0.10 -vvvvv --messages --eos-on-shutdown v4l2src ! 'video/x-raw-yuv, width=640, height=480' ! videorate ! 'video/x-raw-yuv, framerate=15/1' ! queue max-size-bytes=100000000 max-size-time=0 ! theoraenc bitrate=150 ! oggmux ! tee name=ogged ! queue max-size-bytes=100000000 max-size-time=0 ! oggdemux ! theoradec ! xvimagesink sync=false ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! filesink location=`date +%F_%T`.ogv ogged. ! queue max-size-bytes=100000000 max-size-time=0 ! shout2send ip=media.basilgohar.com port=8000 password=***passwordhidden*** mount=/basil-at-work.ogv streamname='Basil at Work' description='Live video stream of me at work' genre='Webcam' url='http://media.basilgohar.com/stream/' ogged.

It might seem a bit daunting at first, and yes, it's taken me a while
before I can figure that out and piece it together myself (with plenty
of help from #gstreamer, especially ds & MikeS).

To explain each step, I am first capturing from my webcam (a v4l2
device), I reduce the framerate to 15 fps (since it only does 30 fps
natively).  I then encode that stream into Theora at a constant bitrate
of 150 kbps.  I then mux the raw Theora video into an Ogg container. 
Then I demux and decode the video again to view it realtime on screen
(so I can see the quality of it as it will be streamed.  Then I write
the file to disk.  Then, finally, I do the actual streaming of the file
out to my IceCast2 server.

Previously, I used to do this with a combination of ffmpeg for capturing
the video, encoder_example (from the libtheora source) for the video
encoding, and then oggfwd for sending it out to the actual server for
streaming.  Now I can use gstreamer for all the parts, from start to finish.

Oh, the link...;)

http://media.basilgohar.com/stream/

You can view that embedded in the browser directly, or you can use that
page and grab the raw URL and watch the stream however you like.

-- 
*Basil Mohamed Gohar*
abu_hurayrah at hidayahonline.org
http://www.basilgohar.com/blog/

IslamicHomeschool.com - Islamic Education for the Home
<http://www.islamichomeschool.com/>


More information about the theora mailing list