RTMP transcoding in #raspberrypi = 4fps! #Linux

Oscar Brito


Last week I was trying to make my raspberry stream RTMP. This protocol was created by Macomedia to
real time data transfer over the Internet.

The streams I was trying to play were FLV, in other words H.263 witch I soon realize that could be a problem with omxplayer.

1) I started by compiling ffmpeg:


cd src/

apt-get source ffmpeg-dmo

cd ffmpeg-dmo/



./configure

make


sudo make install


2) Put mplayer working by compiling and disabling mencoder:


./configure --target=arm-linux --disable-mencoder

make

sudo make install


3) Compile and install rtmpdump to download streams...


git clone git://git.ffmpeg.org/rtmpdump 

cd rtmpdump 


make SYS=posix
sudo checkinstall --pkgname=rtmpdump --pkgversion="2:$(date +%Y%m%d%H%M)-git" --backup=no
--deldoc=yes --fstrans=no --default

make install

ln -s /usr/local/lib/librtmp.so.0 /usr/lib/arm-linux-gnueabihf/librtmp.so.0





The fun part comes next. To get the stream I can make:


rtmpdump -v -r rtmp://h2j2.rtp.pt/livetv -W http://www.rtp.pt/play/player.swf -p http://www.rtp.pt/services/rtpplay/pub/config_page/rtp.pt/play/direto/tv/rtp1 --playpath "2ch5h264" -R --live -b 20000 -V stream.flv

This saves the realtime stream into a file. Nice if you want to make a recorder!

I need now to convert the FLV into AVI to be able to player in omxplayer.


# lets create a named pipe



mkfifo stream.avi



rtmpdump -v -r rtmp://h2j2.rtp.pt/livetv -W http://www.rtp.pt/play/player.swf -p http://www.rtp.pt/services/rtpplay/pub/config_page/rtp.pt/play/direto/tv/2ch5h264 --playpath "2ch5h264" -b 20000 | ffmpeg -i pipe:0 -y -loglevel debug -b:v 400k -stats stream.avi;




After this I notice that I could only get 4fps! dammit.... this means that raspberry is not capable of downloading and transcoding the stream....

Even so, if you want to try to play (while running rtmpdump command):


omxplayer stream.avi


A possible workaround is use another machine to transcode and serve the stream to raspberry, minimizing his work....

Maybe serve it with VLC...Maybe next time.





Visit www.divhide.com for more informations, contacts and news about Web Development.
See other blog posts at blog.divhide.com.



Divhide purpose is to follow the HTML5 movement and contribute with applications which prove the quality of technology.


Feel free to contact divhide.