View RTMP Stream on Raspberry Pi

41,505

39

15

Posted

Introduction: View RTMP Stream on Raspberry Pi

Here's a simple and straightforward technique to view RTMP streams on the Raspberry Pi.

For this, you will need the following installed on your R-Pi
- omxplayer (installed by default)
- mkfifo (installed by default)
- rtmpdump (not installed by default)

You can install rtmpdump by issuing the command 'sudo apt-get install rtmpdump' from any terminal window on the R-Pi.

First, create a named pipe. A named pipe is essentially a FIFO buffer memory which is referenced by a name. This named pipe will be used for dumping and viewing your stream. You can create a named pipe using the command ' mkfifo name_of_pipe  '

Now, use rtmpdump to read the live stream and dump it on to the named pipe you created earlier. Simultaneously, use omxplayer to play the content dumped on to the named pipe. This can be done with the following command:

rtmpdump -r rtmp://url_of_rtmp_stream --live -o name_of_pipe  | omxplayer name_of_pipe

At a Glance:

- Install rtmpdump
    sudo apt-get install rtmpdump
- Create Named Pipe
    mkfifo /tmp/livevideo
-Play RTMP stream
    rtmpdump -r rtmp://url_of_stream/ --live -o /tmp/livevideo | omxplayer /tmp/livevideo

Watch a video demonstration of this on the YouTube video linked here. http://www.youtube.com/watch?v=HXA_w8Hkjeo

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    15 Comments

    Not sure when the change was made, but with the latest omxplayer, you can now pass the rtmp stream path as a parameter. From the Raspian command line: omxplayer rtmp://ip.address:port/stream-name

    Example:

    omxplayer rtmp://10.11.123.100:1935/live/mystream
    I believe the default rtmp port is 1935.

    I tried this and it does not seem to work for me. I also tried the method recommended in the link http://www.youtube.com/watch?v=HXA_w8Hkjeo and it did not work either.

    I am able to run omxplayer with video files such as:

    omxplayer test01.mpg

    or

    omxplayer FILE2713.MOV

    I use vMix running on a PC to create my streams. I have installed mistserver on my RaspBerry Pi and I am able to view that stream through the mistserver API interface - so I know the vMix can successfully send an rtmp stream to the PI.

    But what I need to do is use the vMix on the PC to create a stream which I can view on the PI's composite video output.

    I keep getting this error:

    Connecting ...

    ERROR: RTMP_Connect0, failed to connect socket. 110 (Connection timed out)

    bob@Bob-RPI-Ubuntu:~$

    I have the following version of omxplayer

    bob@Bob-RPI-Ubuntu:~$ omxplayer --version

    omxplayer - Commandline multimedia player for the Raspberry Pi

    Build date: Fri, 23 Sep 2016 00:56:49 +0000

    Version : dfea8c9 [master]

    Repository: https://github.com/popcornmix/omxplayer.git

    Hoping for some help with this. Thanks.

    Hello,
    If i want to take a saved video file from raspberry pi and play it live on my PC, how can I do that?

    I am getting

    "Invalid framerate 1000, using forced 25fps and just trust timestamps" then "Have a nice day"

    I'm run following your command but got this error

    ERROR: RTMP_Connect0, failed to connect socket. 111 (Connection refused)

    hi kniac,

    this could probably be because the firewall on your pc is blocking some ports used by RTMP. try turning off the windows firewall and see if it helps.

    I turned off my firewall and tried running it again, but it did not work. I got the same error. Any more advice for this?

    Hi,

    thanks for your guide. I tried with a live stream, it works but omxplayer doesn't show anything in the screen. What I'm missing? I just followed your guide. Cheers

    how do you show graphics from the command prompt? is this using xfb?