<?xml version="1.0" encoding="utf-8"?>

<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">oliviergrisel.name</title>
<subtitle type="html"><![CDATA[
Technical blog about AI programming and Open Source technologies
]]></subtitle>
<id>http://oliviergrisel.name/index.atom</id>
<link rel="alternate" type="text/html" href="http://oliviergrisel.name" />
<link rel="self" type="application/atom+xml" href="http://oliviergrisel.name/index.atom" />


<author>
<name>Olivier Grisel</name>
<uri>http://oliviergrisel.name/index.atom</uri>
<email>olivier.grisel@ensta.org</email>
</author>
<rights>Copyright 2008 Olivier Grisel - Licensed under CC-By-SA 3.0</rights>
<generator uri="http://pyblosxom.sourceforge.net/" version="1.4.3 01/10/2008">
PyBlosxom http://pyblosxom.sourceforge.net/ 1.4.3 01/10/2008
</generator>

<updated>2008-08-02T16:20:06Z</updated>
<!-- icon?  logo?  -->

<entry>
<title type="html">[FOSDEM 2008] Programming with Linux on the PS3</title>
<category term="" />
<id>http://oliviergrisel.name/2008/08/02/2008-02-24-fosdem-programming-with-linux-on-the-ps3</id>
<updated>2008-08-02T16:20:06Z</updated>
<published>2008-08-02T16:20:06Z</published>
<link rel="alternate" type="text/html" href="http://oliviergrisel.name/2008-02-24-fosdem-programming-with-linux-on-the-ps3.og" />
<content type="html">
&lt;p&gt;On February the 23rd I had the opportunity to give a presentation on
programming the Cell BE processor of the Playstation 3 at the
2008 edition of the &lt;a href=&quot;http://fosdem.org&quot;&gt;FOSDEM&lt;/a&gt;
in Brussels. You can download my slides as &lt;a
href=&quot;/static/2008/02/programming-the-ps3.pdf&quot;&gt;pdf&lt;/a&gt; or &lt;a
href=&quot;/static/2008/02/programming-the-ps3.odp&quot;&gt;open document format
(odp)&lt;/a&gt;. The talk was recorded by the devroom organizers. The
following player can be used to preview it or you can grab the
&lt;a href=&quot;/static/2008/02/fosdem2008-olivier-grisel-linux-ps3.ogg&quot;&gt;ogg/theora+vorbis video&lt;/a&gt;
and use a suitable player (such as &lt;a href=&quot;http://videolan.org/vlc&quot;&gt;vlc&lt;/a&gt;).&lt;/p&gt;

&lt;div style=&quot;width:425px;text-align:left; margin:auto&quot;&gt;&lt;object width=&quot;420&quot; height=&quot;357&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.dailymotion.com/swf/x6aiog&amp;related=0&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.dailymotion.com/swf/x6aiog&amp;related=0&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;420&quot; height=&quot;357&quot; allowFullScreen=&quot;true&quot; allowScriptAccess=&quot;always&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;strong&gt;&lt;a href=&quot;http://www.dailymotion.com/video/x6aiog_fosdem2008oliviergrisellinuxps3_tech&quot;&gt;Fosdem2008-olivier-grisel-linux-ps3&lt;/a&gt;&lt;/strong&gt;&lt;/div&gt;

&lt;div style=&quot;width:425px;text-align:left; margin:auto&quot; id=&quot;__ss_288043&quot;&gt;&lt;object style=&quot;margin:0px&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://static.slideshare.net/swf/ssplayer2.swf?doc=programming-the-ps3-1204381390301020-2&quot;/&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;/&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;/&gt;&lt;embed src=&quot;http://static.slideshare.net/swf/ssplayer2.swf?doc=programming-the-ps3-1204381390301020-2&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style=&quot;font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/?src=embed&quot;&gt;&lt;img src=&quot;http://static.slideshare.net/swf/logo_embd.png&quot; style=&quot;border:0px none;margin-bottom:-5px&quot; alt=&quot;SlideShare&quot;/&gt;&lt;/a&gt; | &lt;a href=&quot;http://www.slideshare.net/ogrisel/programming-the-ps3?src=embed&quot; title=&quot;View &apos;Programming the PS3&apos; on SlideShare&quot;&gt;View&lt;/a&gt; | &lt;a href=&quot;http://www.slideshare.net/upload?src=embed&quot;&gt;Upload your own&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you have a PS3 and want Ubuntu Linux
installed on it, please have a look at the &lt;a
href=&quot;https://help.ubuntu.com/community/PlayStation_3&quot;&gt;official Ubuntu
help page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;FYI I had installed the latest version of 7.4 for PS3 using the
alternate CD (text based) installer and then upgraded to 7.10 later with
aptitude. Other distros have their own PS3 howto.&lt;/p&gt;

&lt;p&gt;Once you have Linux up and running I suggest you to first have a look
at the following resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
    href=&quot;http://www.kernel.org/pub/linux/kernel/people/geoff/cell/ps3-linux-docs/&quot;&gt;
    General documentation for Linux on the Cell&lt;/a&gt; by Geoff Levand on kernel.org&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.kernel.org/pub/linux/kernel/people/geoff/cell/ps3-linux-docs/ps3-linux-docs-08.06.09/CellProgrammingPrimer.html&quot;&gt;
    Tutorial to learn SPE programming&lt;/a&gt; on kernel.org too&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/FC857AE550F7EB83872571A80061F788&quot;&gt;The official IBM tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/power/cell/&quot;&gt;The IBM
    developerworks resource center&lt;/a&gt; that has further pointers to official
  documentation, forums, SDK releases and third party websites&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also join the IRC channel &lt;tt&gt;#PS3Dev&lt;/tt&gt; on freenode.org
where I tend to be connected as ogrisel.&lt;/p&gt;

&lt;p&gt;Finally you might want to have a look at the &lt;a
  href=&quot;https://launchpad.net/simd4libsvm&quot;&gt;simd4libsvm&lt;/a&gt; project I
  started on
launchpad to add SIMD and threading support to the &lt;a
href=&quot;http://www.csie.ntu.edu.tw/~cjlin/libsvm&quot;&gt;libsvm&lt;/a&gt; open
source library. This library is the reference implementation of the
&lt;a href=&quot;http://en.wikipedia.org/wiki/Support_vector_machine&quot;&gt;Support
Vector Machines&lt;/a&gt; machine learning algorithms.&lt;/p&gt;

</content>
</entry>

<entry>
<title type="html">How to broadcast a live video stream</title>
<category term="" />
<id>http://oliviergrisel.name/2008/06/21/2008-05-24-howto-broadcast-live-video-stream</id>
<updated>2008-06-21T21:31:27Z</updated>
<published>2008-06-21T21:31:27Z</published>
<link rel="alternate" type="text/html" href="http://oliviergrisel.name/2008-05-24-howto-broadcast-live-video-stream.og" />
<content type="html">
&lt;div class=&quot;left&quot;&gt;
  &lt;img src=&quot;/static/2008/05/pycon_fr_2008.png&quot; alt=&quot;Pycon FR 2008&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
As a member of the French Python user group (&lt;a href=&quot;http://afpy.org&quot;&gt;AFPy&lt;/a&gt;)
I took part in the organization the second edition of
&lt;a href=&quot;http://fr.pycon.org&quot;&gt;Pycon FR&lt;/a&gt; in Paris last week. The event itself
was a great success with more than 120 physical attendees and on average 40 people
remotely attending the event through our &lt;a href=&quot;http://fr.pycon.org/stream-live&quot;&gt;
live video stream&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;The following shows how we got the stream up and working hoping that our
experience might help other benevolent conference organizers to set up a
similar 100% free software based infrastructure.&lt;/p&gt;

&lt;h4&gt;The setup&lt;/h4&gt;

&lt;div class=&quot;right&quot;&gt;
  &lt;img src=&quot;/static/2008/05/streaming_room.jpeg&quot; alt=&quot;Streaming room&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;The &lt;a href=&quot;http://fr.pycon.org/presentation&quot;&gt;Agora room&lt;/a&gt; of the
Cit&amp;eacute; des Sciences et de l&apos;Industrie features sonically isolated
monitoring room with a high bandwidth internet connection. The room
is equipped with 3 remote controlled cameras and 2 microphones. Three
monitors and a remote control allows the operator to adjust the cameras
and select the one to broadcast. The audio-video analogical signal
is then plugged into a movie box that outputs a live DV stream over a
firewire link.&lt;/p&gt;

&lt;p&gt;The movie box is then plugged into a Core 2 Duo laptop running Ubuntu Gutsy.
The laptop is used to encode the DV stream into a ogg theora / vorbis stream
using the &lt;a href=&quot;http://www.v2v.cc/~j/ffmpeg2theora/&quot;&gt;ffmpeg2theora&lt;/a&gt; utility.
The unix &apos;tee&apos; command is used to pipe a local copy of the video on laptop hard
drive while broadcasting to the remote streaming server using the
&lt;a href=&quot;http://www.v2v.cc/~j/oggfwd/&quot;&gt;oggfwd&lt;/a&gt; tool.&lt;/p&gt;

&lt;p&gt;The streaming server is a single kimsufi box running Ubuntu Feisty
with &lt;a href=&quot;http://www.icecast.org/&quot;&gt;icecast&lt;/a&gt;. The bandwidth
of the server is 100 Mbps which should be enough for up to 400
simultaneous clients (for a stream at 250 Kbps). For more clients it is possible
to setup several icecast relays and spread the load across them.&lt;/p&gt;

&lt;p&gt;
Here is the helper script I saved as ~/bin/oggbroadcast on the laptop that did
the live acquisition of the DV signal through a cheap PCMCIA / firewire adapter
I found &lt;a href=&quot;http://www.ldlc.com/fiche/PB00019594.html&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;div style=&quot;clear: both&quot;&gt;&lt;/div&gt;

&lt;pre&gt;
#!/bin/sh

# encoding and broadcasting settings
X=320
Y=240
SERVER_NAME=oliviergrisel.name
SERVER_PORT=8000
PASSWORD=theprecious
MOUNT_POINT=/pycon_fr_2008_live.ogg
STREAM_TITLE=&quot;Pycon FR live stream&quot;

# local copy settings
BACKUP_DIR=/home/ogrisel/streams
TIME_STAMP=`date +%F-%T`

# ensure the backup directory exists
mkdir -p $BACKUP_DIR

# the actual grabing / encoding / broadcasting chain
dvgrab -f raw - | \
  ffmpeg2theora -a 1 -v 6 -f dv -x $X -y $Y -o /dev/stdout - | \
  tee $BACKUP_DIR/stream_${TIME_STAMP}_${X}x${Y}.ogg | \
  oggfwd -n &quot;$STREAM_TITLE&quot; $SERVER_NAME $SERVER_PORT $PASSWORD $MOUNT_POINT
&lt;/pre&gt;

&lt;p&gt;
These encoding settings (X=320, Y=240, -a 1 and -v6) give a 250kbps ogg stream
(around 180kbps for the video and 70kbps for the audio). I think these settings
are optimal for live streaming since any broadband user should be able to track
the presentations without interruption.
&lt;/p&gt;

&lt;p&gt;
The video quality is unfortunately too poor to make it possible to read the
slide contents on most presentations. Next year we will collect the slide files
earlier to be able to publish them on our website before the beginning of the
event so as the remote attendees not to be penalized by the video quality.
&lt;/p&gt;

&lt;h4&gt;Lessons learned&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
Icecast is a very stable and easy to setup streaming server. I just aptitude
install&apos;ed it then tweaked the configuration file under /etc/icecast2 mainly to
adjust the passwords for the admin interface and the stream source.
&lt;/li&gt;

&lt;li&gt;the automatic CPU frequency scaler can get really annoying. On the first day
the encoding chain was interrupted several times because for some reason it
decided that running at 100% at 1Ghz on one of the cores was better than
running at 20% at 2.17GHz. At 1GHz the encoding is not fast enough to make it
live without interruption. To avoid those problems set the CPU energy policy
to &quot;performance&quot;:
&lt;pre&gt;sudo cpufreq-selector -g performance&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;the quality is good enough for live broadcasting but it would have been nice
to put the &apos;tee&apos; command responsible for making the local copy one step earlier
in the chain (before the encoding step). Unfortunately storing the original DV
signal takes an awful amount of disk space. Next year it might be a good idea to
invest in a new external drive for that purpose only.&lt;/li&gt;

&lt;li&gt;advertising the IRC channel name on the stream web page was a very good idea.
The internet attendees could exchange together on the presentation hence getting
the feeling to really attend the event as almost first class citizens. Some of the
geeks in the real life conference room were connected too and could thus discuss
about the presentation without disturbing the audience and proxy remote IRC
questions to the speaker.&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;Going further&lt;/h4&gt;

For the next year I plan to further have a look at other ogg theora streaming
tools that might provide additional features:

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://boxtream.unice.fr/&quot;&gt;boxstream&lt;/a&gt;, a python
  graphical utility based on gstreamer to upload a compound stream with
  overlays to an icecast server&lt;/li&gt;

  &lt;li&gt;&lt;a href=&quot;http://www.flumotion.net/&quot;&gt;flumotion streaming server&lt;/a&gt;,
  a complete python-based streaming solution (with a server part based
  on twisted)&lt;/li&gt;
&lt;/ul&gt;


By the way, if you speak french, please have a look
at the &lt;a href=&quot;http://dl.afpy.org/pycon-fr-08/&quot;&gt;videos&lt;/a&gt;
(postprocessed by &lt;a href=&quot;http://ccomb.free.fr&quot;&gt;ccomb&lt;/a&gt;) and the &lt;a
href=&quot;http://fr.pycon.org/presentations_2008/&quot;&gt;slides&lt;/a&gt; of the
presentations&lt;/a&gt;.

</content>
</entry>
</feed>
