RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    RetroPie Screen Mirroring / Streaming / Casting

    Scheduled Pinned Locked Moved General Discussion and Gaming
    mirrorcaststream
    22 Posts 7 Posters 11.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • herb_fargusH
      herb_fargus administrators
      last edited by

      There are a few different methods to mirror/cast/record video from the pi to an external display. Just thought I'd consolidate some thoughts.

      One method is a VNC server which doesn't really work with RetroPie as it doesn't use an X server.

      An alternate would be to use Dispmanx VNC

      In theory it should work without X.

      Another option for retropie might be the raspidisp driver as part of UV4L (webrtc)

      I'm expecting lag and barely passable functionality but thought I would just try some things out as a proof of concept and will update the post accordingly as I make progress. Would be interested in any other results if anyone else is trying the same thing.

      If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

      Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

      1 Reply Last reply Reply Quote 2
      • Z
        zerojay
        last edited by

        External video capture card with HDMI passthrough.

        herb_fargusH 1 Reply Last reply Reply Quote 0
        • herb_fargusH
          herb_fargus administrators @zerojay
          last edited by

          @zerojay I'm mostly just thinking of software solutions. not solutions that work!

          If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

          Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

          1 Reply Last reply Reply Quote 0
          • herb_fargusH
            herb_fargus administrators
            last edited by herb_fargus

            Dispmanx VNC:

            Dependencies:

            sudo apt-get install libvncserver-dev

            Installation:

            Clone github repo:

            git clone https://github.com/hanzelpeter/dispmanx_vnc.git
            

            Modify makefile for stretch:

            nano makeit

            change
            -lGLESv2 to -lbrcmGLESv2
            and
            -lEGL to -lbrcmEGL

            make executable:

            chmod +x makeit
            

            Compile:

            sudo ./makeit
            

            run server:

            sudo ./dispman_vncserver 
            

            then you need a vnc client, krdc seemed to work fine on mine and i just connected with the IP at port 5900 eg 192.168.1.63:5900

            runs at a cool 15 FPS! also only worked when I was using kodi, just shows black screen for others so, might be a bit subjective

            If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

            Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

            1 Reply Last reply Reply Quote 1
            • herb_fargusH
              herb_fargus administrators
              last edited by herb_fargus

              UV4L raspidisp

              installation

              Dependencies:

              curl http://www.linux-projects.org/listing/uv4l_repo/lpkey.asc | sudo apt-key add -
              

              add to /etc/apt/sources.list

              deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/stretch stretch main
              

              Install:

              sudo apt-get update
              sudo apt-get install uv4l  uv4l-server uv4l-webrtc uv4l-raspidisp uv4l-raspidisp-extras
              

              Then I used this to start the server

              uv4l --auto-video_nr --driver raspidisp --server-option '--enable-webrtc=yes'
              

              There are obviously some tweaks that can be made and lots of the arguments are detailed in the man pages.

              then I accessed it from my web browser at http://192.168.1.63:9080/stream/webrtc/ then just clicked call at the bottom and viola. The audio doesn't work by default and they mentioned it would need a loopback of sorts with alsa, I delved into that in the past and failed miserably but it funtions so thats cool.

              If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

              Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

              ClydeC 1 Reply Last reply Reply Quote 1
              • madmodder123M
                madmodder123
                last edited by

                I know this isn't exactly streaming/mirroring/casting, but this utility is great for grabbing screenshots directly from the Pi's framebuffer: https://github.com/AndrewFromMelbourne/raspi2png

                herb_fargusH 1 Reply Last reply Reply Quote 0
                • herb_fargusH
                  herb_fargus administrators @madmodder123
                  last edited by

                  @madmodder123 I've used it and I wasn't particularly enamoured with the quality of the screenshots though it's definitely a step up from a screenshot with a phone. Also possible it could be fixed with some config tweaks but I didn't look into it too much.

                  If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                  Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                  1 Reply Last reply Reply Quote 0
                  • ClydeC
                    Clyde
                    last edited by

                    First and foremost, many thanks for this, as I'm toying with the idea of streaming my cabinet's picture to my video projector (just mentioned for others here, as you already know it from the other thread we talked in).

                    Alas, both options have issues on Retropie 4.3 based on Debian Jessie which I'm still using on my cabinet, because I didn't want to change a running system without reasons. I may have a reason now, but it keeps me from testing it right now, and I'm reluctant to upgrade to 4.4 because of its issues with the order of joysticks.

                    DISPMANX: On 4.3, I get only around 4-5 fps with krdc 4.13.0 on Kubuntu 14.04 (yeah, I also never changed that running system, but I plan to upgrade to 18.04 when its first point release 18.04.1 comes out in summer). Maybe because of lGLESv2 and lEGL on Jessie? As suspected, with lbrcmGLESv2 and lbrcmEGL there is no picture on the client, but I wanted to try it to be sure.

                    UV4L raspidisp: Can't install it because an unmet dependency for libssl1.0.2.

                    $ sudo apt install uv4l uv4l-server uv4l-webrtc uv4l-raspidisp uv4l-raspidisp-extras
                    Reading package lists... Done
                    Building dependency tree       
                    Reading state information... Done
                    Some packages could not be installed. This may mean that you have
                    requested an impossible situation or if you are using the unstable
                    distribution that some required packages have not yet been created
                    or been moved out of Incoming.
                    The following information may help to resolve the situation:
                    
                    The following packages have unmet dependencies:
                     uv4l-server : Depends: libssl1.0.2 but it is not installable
                    E: Unable to correct problems, you have held broken packages.
                    

                    Do you have any ideas for this aside from installing Retropie 4.4?

                    herb_fargusH 1 Reply Last reply Reply Quote 0
                    • herb_fargusH
                      herb_fargus administrators @Clyde
                      last edited by herb_fargus

                      @clyde said in RetroPie Screen Mirroring / Streaming / Casting:

                      Do you have any ideas for this aside from installing Retropie 4.4?

                      Sorry my posts we're implied I was working off stretch.

                      No time like the present to upgrade to the supported OS. SD cards are relatively cheap, I have at least 8 for testing.

                      If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                      Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                      ClydeC 1 Reply Last reply Reply Quote 0
                      • ClydeC
                        Clyde @herb_fargus
                        last edited by

                        @herb_fargus Yeah, I think you're right. Off to the vendor! (in the coming week)

                        1 Reply Last reply Reply Quote 0
                        • 6
                          6Alli
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • ClydeC
                            Clyde @herb_fargus
                            last edited by Clyde

                            @herb_fargus Hi, I finally got to install Retropie 4.4, but I ran into a problem with UV4L. I followed your instructions by the letter. Starting the server got me this:

                            $ uv4l --auto-video_nr --driver raspidisp --server-option '--enable-webrtc=yes'
                            <notice> [core] Trying to loading driver 'raspidisp' from built-in drivers...
                            <notice> [core] Loading driver 'raspidisp' from external plug-in's...
                            <notice> [driver] RaspiDisp Video4Linux2 Driver built Jan 31 2017
                            <notice> [core] Device detected!
                            <notice> [core] Registering device node /dev/video0
                            

                            The server is running on pids 3215 and 3065 according to pidof uv4l. But when I try to connect by http://ip.of.my.raspi:9080/stream/webrtc/, the browser says:

                            Page Not Found or Access Denied
                            

                            The PC I'm trying to connect from runs Kubuntu Linux 14.04. The error occurs in Firefox 59.0.2 as well as Chromium 65.0.3325.181.

                            What could be wrong?

                            herb_fargusH 1 Reply Last reply Reply Quote 0
                            • herb_fargusH
                              herb_fargus administrators @Clyde
                              last edited by

                              @clyde hrm. I don't remember mine saying /dev/video0, it was dev something else I forget. Did you try it with sudo /rebooting the pi?

                              If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                              Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                              ClydeC 1 Reply Last reply Reply Quote 0
                              • ClydeC
                                Clyde @herb_fargus
                                last edited by Clyde

                                @herb_fargus Rebooting didn't change the error, but uv4l only has one pid now.

                                I also have an issue with dispmanx vnc. It works, but although it shows approx. 13 fps on the Pi, krdc on my pc only gets appros 2 fps with high quality and 3 fps with medium quality. Low quality doesn't show a picture at all.

                                edit: The poor vnc performance might be because my Retropi runs on 1600x1200 …

                                1 Reply Last reply Reply Quote 0
                                • ClydeC
                                  Clyde
                                  last edited by

                                  Update: I can connect to the server's menu via http://ip.of.my.raspi:8080. There, "Server Info" says:

                                  Streaming Server Informations and Statistics

                                  • basic HTTP/HTTPS authentication: disabled
                                  • underlying video device node: /dev/video0
                                  • current connections: 1, queued: 0, total handled: 15
                                  • max. simultaneous streams allowed: 3, max. threads: 5
                                  • raw HTTP/HTTPS video streams in MJPEG, JPEG (continuous stills) and H264 formats - if supported - are available under the /stream/video.mjpeg, /stream/video.jpeg, and /stream/video.h264 URL paths respectively

                                  But none of the listed url paths work. They give the error ERR_EMPTY_RESPONSE.

                                  ClydeC 1 Reply Last reply Reply Quote 0
                                  • ClydeC
                                    Clyde @Clyde
                                    last edited by Clyde

                                    Okay, I got it: I just had to use your URL with my server's port 8080. I don't know why your server has a different port, since I only followed your instructions. But it works now with an acceptable framerate, albeit not as high as the original.

                                    So, thanks very much for this solution! Do you have any tipps for optimizing the frame rate? My video projector's resolution is 1280x720, I'd like to render the stream in this resolution. If you happen to know the options to do that, I'd be thankful. Otherwise, I'll try to read them up.

                                    herb_fargusH 1 Reply Last reply Reply Quote 0
                                    • herb_fargusH
                                      herb_fargus administrators @Clyde
                                      last edited by

                                      @clyde glad you got it figured out. you probably know as much about it as I do at this point. Uv4l has manpages with different settings that could probably be tweaked to improve performance.

                                      If you/I were really ambitious we could develop a custom web app plug-in specific to streaming for retropie (uv4l had an example of an app for face tracking)

                                      If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                                      Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                                      ClydeC 1 Reply Last reply Reply Quote 0
                                      • ClydeC
                                        Clyde @herb_fargus
                                        last edited by

                                        @herb_fargus One feature I'd like would be a direct stream without any web interface that could be viewed by a network-compatible media player like vlc. If that's possible already, I didn't figure it out although I read many uv4l docs and tutorials.

                                        Do you know (or suspect) which video format the webrtc plugin streams to /dev/video0 in? I tried to grab that device with cvlc and stream it to another cvlc running on my pc with Kubuntu like described in this tutorial, but cvlc on the Pi didn't recognize the format coming from /dev/video0 (even calling it "garbage" at one point).

                                        As for developing a custom plug-in, I am open for that in principle, but I have no programming expertise at all, apart from some very basic bash scripting (example).

                                        mituM 1 Reply Last reply Reply Quote 0
                                        • mituM
                                          mitu Global Moderator @Clyde
                                          last edited by

                                          @clyde said in RetroPie Screen Mirroring / Streaming / Casting:

                                          Do you know (or suspect) which video format the webrtc plugin streams to /dev/video0 in?

                                          Something like this - https://www.linux-projects.org/uv4l/tutorials/rtsp-server/ ?

                                          ClydeC 1 Reply Last reply Reply Quote 0
                                          • ClydeC
                                            Clyde @mitu
                                            last edited by

                                            @mitu Sorry for the late answer, I somehow missed your reply. 😮

                                            Your link points to a tutorial for the raspicam driver. It has an --encoding option the raspidisp driver is missing, unfortunately.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.