Cymaphore

Now and then

Our world is made of glass

17.10.2012, 22:28 Bambuser: Using FFmpeg as streaming application

Bambuser is a nice streaming service. It's extremely popular among political activists to provide video feeds from meetings and demonstrations alike. When traditional media are not interested, ordinary people step in using Bambuser and similar services. If you're not using an Android- or iOS-based mobile device, its flash based service allows to stream from within your webbrowser. However, it has some serious flaws about quality and capabilities. On the other hand there are also a few desktop applications job. Bambuser recommends Adobe Flash Media Live Encoder (Windows), Telestream Wirecast (Mac OS X) and Vidblaster (Windows). They are widely used, but in many aspects not very useful. They all have huge overhead in resource consumption. If you want to stream to Bambuser using GNU/Linux, you'll find only crap like Webcam Studio.
But you don't need all of that. Since Bambuser uses RTMP as upstream protocol, you can easily resort to simpler, more powerful tools, like FFmpeg. However, you need to run it from command line, since no FFmpeg UI I know has acceptable support for the required features.
Just login to your Bambuser account, at the “Dashboard” select “Flash Media Live Encoder”. There is a link to your personal “authentication profile”. This xml file contains the required upstream URL. Download it and open it in an editor of your choice (the file is encoded in UTF-16, in case your editor doesn't detect that automatically). Within the file you find the rtmp-tag (flashmediaencoder_profile > output > rtmp). Take the content of the stream tag, append it to the content of the url tag (separated by a slash) – that's your personal upstream url. It should finally look something like:
rtmp://509544.fme.bambuser.com/b-fme/8dd88a433140fea71510c307871386113116ca1c
Now you need FFmpeg. There should be a package for your GNU/Linux distribution. Watch out to install H264 support as well (Debian/Ubuntu: Packages libx264-120 and x264). FFmpeg for Windows has H264 support built-in.
Now you are ready to start streaming. The following commands demonstrate how to use FFmpeg to stream video from a Webcam or other (USB-)Camera, draw a png-logo on the it, shrink it to a appropriate size, stream it to Bambuser and simultaneously store the unmodified video on your hard drive. All in one command :-)

Linux

ffmpeg -f video4linux2 -i /dev/video0 -f alsa -i hw:1 -ab 64k -ar 44100 -b:v 200k -r 10 -s 320x240 -vf "movie=piraten-stuttgart.de.png [logo];[in][logo] overlay=W-w-10:H-h-10 [out]" -f flv rtmp://509544.fme.bambuser.com/b-fme/8dd88a433140fea71510c307871386113116ca1c -c copy "recording-$(date +%d.%m.%Y-%H.%M.%S).mkv"
Uses v4l2 interface using video-device /dev/video0 and alsa-audio-device hw:1. Date and time is appended to the recording file.

Windows

ffmpeg -f dshow -i video="USB-Videogerät":audio="HX-WA20" -ab 64k -ar 44100 -b:v 200k -r 10 -s 320x240 -vf "movie=piraten-stuttgart.de.png [logo];[in][logo] overlay=W-w-10:H-h-10 [out]" -f flv rtmp://509544.fme.bambuser.com/b-fme/8dd88a433140fea71510c307871386113116ca1c -c copy "recording-1.mkv"
Using Direct Show, selecting Camera “USB-Videogerät” and Audio-Input “HX-WA20”.

Linux & Windows

To find out what Video- and Audio-Devices are present and where they are located you can use VideoLAN. Just open it, select menu “Media”, “Open Capture Device” and examine the devices listed at “Video device name” and “Audio device name”.
By the way, these instructions should basically work with other RTMP-based streaming services, like Ustream and Piraten-Streaming, as well.
[ Link ]

1 Comments

From Kazimieras, 11.04.2015, 15:46
Thank you, that was helpfull
[ Link ]

Write Comment

Name:
eMail:
Comment:
Hint: Comment must have at least 4 characters.
Name is optional.
eMail-Address is optional and will never be published or shared in any way.
Feeds: Atom, RSS, List