Syphon to RTMP

This idea caught me a while back and it took quite some effort to rebuild it from the leftovers a few days ago. Kids don’t forget: The only difference between noodling around and being a true specialiologist (they don’t call me “Doktor Andy” for nothing) lies in a reusable form of documentation. Fortunately I got this website. What would I do without it.

<TL; DR> video from Mac to Raspberry via network</TL; DR>

The approach uses Syphon, Open Broadcaster Software (obs), nginx and Omxplayer. I guess this ain’t too revolutionary. Using RTMP is quite a common task to distribute video. But it’s a good idea to have it all written down at least once. Furthermore I couldn’t find any kind of writeup like this covering this topic so … it’s okay.

This is the setup. It consists of a MacBook running VDMX and 2 Raspberry Pies (well, and a monitor).

CIMG0616

Starting with the MacBook I am running VDMX and obs (Open Broadcaster Software). VDMX sends its main output via Syphon into obs. Obs, on the other hand, streams it to an RTMP server which is setup on the first of two Raspberry Pies (‘vidserv’, the orange one in the upper picture). The picture below shows how everything is configured on the MacBook. VDMX’s Syphon plugin in the top left corner. Of course, any layer could be selected and sent out via Syphon. The lower right square showing something green is VDMX’s output. The ‘more center-left’ green footage is the preview in obs and shows that it works – at least the first step.

Bildschirmfoto 2015-07-08 um 19.49.04

This picture shows obs’s settings-dialog (German… but I think you’ll find this in other languages as well). Click to enlarge. See how I changed the stream type to ‘user defined streaming-server’ and the URL to rtmp://vidserv/live   . The stream’s key (which is asterisk’ed) is ‘test‘. Remember that ‘vidserv’ ist the hostname of the first raspberry receiving the video data from my MacBook.

Bildschirmfoto 2015-07-08 um 19.49.23

In order for the first Raspberry being able to receive and process the video stream coming from the MacBook I installed a software called nginx. Though I tried a few different approaches and am not quite sure about every step I did any more (…) I am quite sure that most of the pieces of information that helped me came from the obs website itself. I am very much of a Linux noob but got it done. So don’t worry… it IS possible.

At one point you have to configure nginx using a config file. The obs website states the lines below as an example. See the string I marked in bold (‘live’). Guess why the URL of the streaming server is rtmp://vidserv/live     .

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                }
        }
}

You have to have the first Raspberry (‘vidserv’) up and running before you can start streaming from obs. Otherwise it will tell you.

The second Raspberry (‘vidclient’) is connected to the monitor and is running an instance of Omxplayer from the command line:  omxplayer –live –threshold 0 rtmp://vidserv/live/test    . Remember that ‘live’ was configured in the nginx-configfile and ‘test’ was the asterisk’ed streaming key we set within obs. See how it doesn’t work on the first try at all…

Here is another video of the setup. It’s obvious that there is quite some latency involved. I guess we won’t be able to ditch our trusty ol’ TripleHead2Go for now.

[tube]https://www.youtube.com/watch?v=Ch3n4-6b2Ms&feature=youtu.be,800,600[/tube]

In conclusion I’d say that this setup is … not perfect. I somehow think that obs is the one to ‘blame’ here since it’s only available in version 0.10.1 for Mac as time of this writing. Even in the 30 minutes I took to recreate this setup it had to be restarted once or twice. Far worse: it’s consuming a truckload of CPU cycles somewhere between 5% and 30%(!  You can see the CPU load in the status bar of the software in the secod and third picture of this post) . Sometimes the Omxplayer doesn’t recognize the stream on the first try, the overall performance is far from realtime. but anyway. It’s good having this in your toolbag and in situation where all the downsides are acceptable it might come in quite handy.

In order to make things a little bit clearer I drew a diagram about how everything is connected and about how the data travels between the computers. And there’s a little ghost. Being there and being obviously happy =)

CIMG0622

Tagged , , , , , .Speichere in deinen Favoriten diesen permalink.

Kommentare sind geschlossen.