RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Help: Compiling Chiaki - PS4 remote play

    Scheduled Pinned Locked Moved Help and Support
    chiakips4remote playretropiecompilation
    47 Posts 12 Posters 8.2k 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.
    • RedMarsBlueMoonR
      RedMarsBlueMoon
      last edited by

      Not sure if bad form to reply to this old thread but it seems to make sense so I'll just go ahead.

      Has anyone manage to build this for the RPi? This seems super cool and I'd love to try it. If the main stumbling block is openGL I'm thinking it should be possible to work around in the source code. (I'm not saying it would be easy though, I don't know) as if this is a purely streaming type software it shouldn't need advanced 3d?

      It should just need a textured surface to render to right?

      Cheers
      Fred

      1 Reply Last reply Reply Quote 0
      • RedMarsBlueMoonR
        RedMarsBlueMoon
        last edited by

        Apparently there was some progress and I just didn't find the thread.
        https://github.com/thestr4ng3r/chiaki/issues/126

        1 Reply Last reply Reply Quote 0
        • RedMarsBlueMoonR
          RedMarsBlueMoon
          last edited by RedMarsBlueMoon

          I managed to get this running pretty well!
          The big monitor is the PS4 screen and the small monitor is the RPi4.

          alt text

          It seems like the sound is not forwarded or coming through for me but I think I saw a note on how that might be fixable so i'll try that.

          The latency is noticeable but not too bad. This is running over LAN and I'm using a wired (to the Pi) PS4 controller.

          I filmed these screens with the slow motion setting of my iphone which records at 240fps. I then counted frames in Premiere and the delay was about 113ms (27 high speed frames).

          I'm not sure yet if my build is using mmal hardware video decoding.

          This build was made by merging the latest master branch into the last version by charliebanks. (https://github.com/charliebanks/chiaki/tree/feature/RPi-Effort)

          Don't ask me how to do it as I'm really bad at Git and its probably better you figure out for yourself. :)

          Next I'm hoping to try to pin down where the latencies are coming from and see if its possible to improve.

          Oh and btw at first when I ran it it crashed as soon as I tried to start a game. Then I started the game first and only after that I engaged with chiaki. That seems to have worked around that issue.

          Z 1 Reply Last reply Reply Quote 0
          • Z
            zerojay @RedMarsBlueMoon
            last edited by zerojay

            @RedMarsBlueMoon said in Help: Compiling Chiaki - PS4 remote play:

            This build was made by merging the latest master branch into the last version by charliebanks. (https://github.com/charliebanks/chiaki/tree/feature/RPi-Effort)

            Don't ask me how to do it as I'm really bad at Git and its probably better you figure out for yourself. :)

            With a mind towards helping people out with this, I've forked the latest Chiaki and cherry-picked the OpenGLes code from Charliebanks so there's no need to do this work manually anymore.

            https://github.com/zerojay/chiaki

            1 Reply Last reply Reply Quote 0
            • RedMarsBlueMoonR
              RedMarsBlueMoon
              last edited by RedMarsBlueMoon

              Nice one @zerojay I just tested your version and it works for me!

              One issue is that this seems to now run at a considerably lower frame rate now than on my very first run when I took the latency numbers. I'd now say that Im only getting 8-10 fps. It would be interesting to hear if others experience the same?
              Or if I have just mucked up my pi environment somehow.

              I looked int the sound but wasn't able to solve it yet. My modest findings can be read here, https://github.com/thestr4ng3r/chiaki/issues/126#issuecomment-712631993

              There's a few people who complain that the streaming worsens after some time playing, like 30 mins or so. And I'm reading that the creators say that 'Congestion Control' has not been added yet so I'm thinking maybe there's a buildup of packets or stream data in a queue and that eventually clogs things up too much?
              I think there are some hints pointing to something like that in the shell output.

              1 Reply Last reply Reply Quote 0
              • RedMarsBlueMoonR
                RedMarsBlueMoon
                last edited by

                Iv'e got the sound working on the raspberry pi4 now!! :)
                What I had to do was,

                1. Install Qt5.12 from https://github.com/koendv/qt5-opengl-raspberrypi (please let me know if this is doable with apt?)

                2. Add the following lines to chiaki/gui/CMakeLists.txt

                set(Qt5Core_DIR "/usr/lib/qt5.12/lib/cmake/Qt53DCore")
                set(Qt5_DIR "/usr/lib/qt5.12/lib/cmake/Qt5")
                set(QT_QMAKE_EXECUTABLE "/usr/lib/qt5.12/bin/qmake")
                

                (assuming that's where the new version got installed on your system)

                NOTE: cmake will get confused because its doubling up the paths and including the old paths as well but luckily these new ones have priority. Again please if you know how to not get the doubling up please let me know!

                1. Build chiaki as usual.

                2. Do 'ldd gui/chiaki' and look for the paths to the Qt libraries. They need to point to the 5.12 versions, Like so,

                libQt5Multimedia.so.5 => /usr/lib/qt5.12/lib/libQt5Multimedia.so.5 (0xb6e6a000)
                

                Now run chiaki and you should hear the sound streaming!

                1 Reply Last reply Reply Quote 0
                • RedMarsBlueMoonR
                  RedMarsBlueMoon
                  last edited by RedMarsBlueMoon

                  Update.

                  Small screen is the Raspberry!
                  Sorry about the camera work I was trying to record with my phone and do some moves at the same time. :D

                  So just got this working pretty well now using Chiaki that I hacked in RPi specific hardware video decoding to. I'm playing over Ethernet here.
                  The game sound you (almost) hear is also coming over the stream and playing through the RPi.

                  720p30 atm but I'm hoping to be able to do 60fps. (I can't test 1080 as I haven't got a PS4-Pro)

                  The code is just hacked in atm but I'm hoping it could get properly added to the project.

                  1 Reply Last reply Reply Quote 1
                  • B
                    b4zyl
                    last edited by

                    Awesome guys! Really appreciate your work !

                    I own PS4 Pro, followed your guide and build Chiaki based on https://github.com/zerojay/chiaki fork. Streaming works fine on Pi4 2GB (30FPS; 720p) but without sound.

                    When i follow Qt5.12 workaround:

                    set(Qt5Core_DIR "/usr/lib/qt5.12/lib/cmake/Qt53DCore")
                    set(Qt5_DIR "/usr/lib/qt5.12/lib/cmake/Qt5")
                    set(QT_QMAKE_EXECUTABLE "/usr/lib/qt5.12/bin/qmake")

                    adding to CMakeLists.txt and create new build i got error when trying run Chiaki :

                    "* failed to add service - already in use?"

                    any idea whats wrong? I put new set line on the begining of CMakeList.txt file.

                    D 2 Replies Last reply Reply Quote 0
                    • D
                      Darkinsi1400
                      last edited by

                      hi, this is really great i tried to compile on fedora by installing all the dependencies .. my nothing wrong there error on error. nevertheless I was wondering if we could compile it directly on the raspberry? (rpi-os) which would be really nice it would be a tutorial to describe step by step :) I will try again because I like to progress ... unfortunately with the covid not had much school and therefore not really advanced in this 1 year. i hope a tutorial comes out .. have a nice day.

                      1 Reply Last reply Reply Quote 0
                      • RedMarsBlueMoonR
                        RedMarsBlueMoon
                        last edited by

                        I have just been working 'offline' so far and not merged my stuff back in.
                        You could try a code upload I did last night that might work better.

                        https://github.com/Fredrum/test_01

                        Note, you still have to add Qt5.12 as mentioned above!

                        The resolution is hardcoded in right now but if you get it generally working first you could try changin to 1080p in,

                        /home/pi/chiaki/chiaki_rpi/gui/src/pihwdecode.cpp
                        around line 116.

                        Also note there's still issues with garbled video stream at startup (should clear up when you start playing)
                        And I'm having trouble with the PS4 Joypad connected to the Pi I have to take it in and out + press PS button 3-4 times before it starts working.

                        So yeah, this is a rough version.

                        B 1 Reply Last reply Reply Quote 0
                        • B
                          b4zyl @RedMarsBlueMoon
                          last edited by

                          @RedMarsBlueMoon

                          thanks, but getting below error once trying to make your test version:

                          -- The C compiler identification is GNU 8.3.0
                          -- The CXX compiler identification is GNU 8.3.0
                          -- Check for working C compiler: /usr/bin/cc
                          -- Check for working C compiler: /usr/bin/cc -- works
                          -- Detecting C compiler ABI info
                          -- Detecting C compiler ABI info - done
                          -- Detecting C compile features
                          -- Detecting C compile features - done
                          -- Check for working CXX compiler: /usr/bin/c++
                          -- Check for working CXX compiler: /usr/bin/c++ -- works
                          -- Detecting CXX compiler ABI info
                          -- Detecting CXX compiler ABI info - done
                          -- Detecting CXX compile features
                          -- Detecting CXX compile features - done
                          -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.3", minimum required is "3") 
                          -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.3", minimum required is "2.7") 
                          -- Found Opus: /usr/include  
                          -- Looking for pthread.h
                          -- Looking for pthread.h - found
                          -- Looking for pthread_create
                          -- Looking for pthread_create - not found
                          -- Looking for pthread_create in pthreads
                          -- Looking for pthread_create in pthreads - not found
                          -- Looking for pthread_create in pthread
                          -- Looking for pthread_create in pthread - found
                          -- Found Threads: TRUE  
                          -- Found OpenSSL: /usr/lib/arm-linux-gnueabihf/libcrypto.so (found version "1.1.1d")  
                          -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29") 
                          -- Checking for module 'libudev'
                          --   Found libudev, version 241
                          -- Checking for module 'libevdev'
                          --   Found libevdev, version 1.6.0
                          -- Found Udev: udev (found version "241") 
                          -- Found Evdev: evdev (found version "1.6.0") 
                          -- Setsu enabled
                          -- QT5 version chosen: /usr/lib/qt5.12/include//usr/lib/qt5.12/include/QtMultimedia/usr/lib/qt5.12/include/QtNetwork/usr/lib/qt5.12/include/QtCore/usr/lib/qt5.12/.//mkspecs/linux-rpi3-g++/usr/lib/qt5.12/include/QtGui/usr/include
                          -- Found SDL2: /usr/lib/arm-linux-gnueabihf/cmake/SDL2/sdl2-config.cmake  
                          -- Checking for module 'libavutil'
                          --   Found libavutil, version 56.22.100
                          -- Checking for module 'libswresample'
                          --   Found libswresample, version 3.3.100
                          -- Checking for module 'libswscale'
                          --   Found libswscale, version 5.3.100
                          -- Checking for module 'libavcodec'
                          --   Found libavcodec, version 58.35.100
                          -- Found FFMPEG: avcodec;avutil (found version "56.22.100") found components:  avcodec avutil 
                          -- Configuring done
                          CMake Error at gui/CMakeLists.txt:50 (add_executable):
                            Cannot find source file:
                          
                              /home/pi/chiaki/chiaki_rpi/third-party/h264bitstream/h264_stream.h
                          
                            Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
                            .hpp .hxx .in .txx
                          
                          
                          CMake Error at gui/CMakeLists.txt:50 (add_executable):
                            No SOURCES given to target: chiaki
                          

                          i think CMakeLists reffers to non existing directory - "chiaki_rpi". Once correcting to /home/pi/chiaki/third-party/

                          i get bellow during make in 60%

                          [ 60%] Building CXX object gui/CMakeFiles/chiaki.dir/src/main.cpp.o
                          In file included from /home/pi/chiaki/gui/include/videodecoder.h:38,
                                           from /home/pi/chiaki/gui/include/streamsession.h:28,
                                           from /home/pi/chiaki/gui/include/streamwindow.h:23,
                                           from /home/pi/chiaki/gui/src/main.cpp:6:
                          /home/pi/chiaki/gui/include/pihwdecode.h:9:10: fatal error: Limelight.h: Nie ma takiego pliku ani katalogu
                           #include "Limelight.h"  // from moonlight
                                    ^~~~~~~~~~~~~
                          compilation terminated.
                          make[2]: *** [gui/CMakeFiles/chiaki.dir/build.make:73: gui/CMakeFiles/chiaki.dir/src/main.cpp.o] Błąd 1
                          make[1]: *** [CMakeFiles/Makefile2:442: gui/CMakeFiles/chiaki.dir/all] Błąd 2
                          make: *** [Makefile:163: all] Błąd 2
                          
                          
                          Z 1 Reply Last reply Reply Quote 0
                          • Z
                            zerojay @b4zyl
                            last edited by

                            @b4zyl said in Help: Compiling Chiaki - PS4 remote play:

                            @RedMarsBlueMoon

                            thanks, but getting below error once trying to make your test version:

                            -- The C compiler identification is GNU 8.3.0
                            -- The CXX compiler identification is GNU 8.3.0
                            -- Check for working C compiler: /usr/bin/cc
                            -- Check for working C compiler: /usr/bin/cc -- works
                            -- Detecting C compiler ABI info
                            -- Detecting C compiler ABI info - done
                            -- Detecting C compile features
                            -- Detecting C compile features - done
                            -- Check for working CXX compiler: /usr/bin/c++
                            -- Check for working CXX compiler: /usr/bin/c++ -- works
                            -- Detecting CXX compiler ABI info
                            -- Detecting CXX compiler ABI info - done
                            -- Detecting CXX compile features
                            -- Detecting CXX compile features - done
                            -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.3", minimum required is "3") 
                            -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.3", minimum required is "2.7") 
                            -- Found Opus: /usr/include  
                            -- Looking for pthread.h
                            -- Looking for pthread.h - found
                            -- Looking for pthread_create
                            -- Looking for pthread_create - not found
                            -- Looking for pthread_create in pthreads
                            -- Looking for pthread_create in pthreads - not found
                            -- Looking for pthread_create in pthread
                            -- Looking for pthread_create in pthread - found
                            -- Found Threads: TRUE  
                            -- Found OpenSSL: /usr/lib/arm-linux-gnueabihf/libcrypto.so (found version "1.1.1d")  
                            -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29") 
                            -- Checking for module 'libudev'
                            --   Found libudev, version 241
                            -- Checking for module 'libevdev'
                            --   Found libevdev, version 1.6.0
                            -- Found Udev: udev (found version "241") 
                            -- Found Evdev: evdev (found version "1.6.0") 
                            -- Setsu enabled
                            -- QT5 version chosen: /usr/lib/qt5.12/include//usr/lib/qt5.12/include/QtMultimedia/usr/lib/qt5.12/include/QtNetwork/usr/lib/qt5.12/include/QtCore/usr/lib/qt5.12/.//mkspecs/linux-rpi3-g++/usr/lib/qt5.12/include/QtGui/usr/include
                            -- Found SDL2: /usr/lib/arm-linux-gnueabihf/cmake/SDL2/sdl2-config.cmake  
                            -- Checking for module 'libavutil'
                            --   Found libavutil, version 56.22.100
                            -- Checking for module 'libswresample'
                            --   Found libswresample, version 3.3.100
                            -- Checking for module 'libswscale'
                            --   Found libswscale, version 5.3.100
                            -- Checking for module 'libavcodec'
                            --   Found libavcodec, version 58.35.100
                            -- Found FFMPEG: avcodec;avutil (found version "56.22.100") found components:  avcodec avutil 
                            -- Configuring done
                            CMake Error at gui/CMakeLists.txt:50 (add_executable):
                              Cannot find source file:
                            
                                /home/pi/chiaki/chiaki_rpi/third-party/h264bitstream/h264_stream.h
                            
                              Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
                              .hpp .hxx .in .txx
                            
                            
                            CMake Error at gui/CMakeLists.txt:50 (add_executable):
                              No SOURCES given to target: chiaki
                            

                            i think CMakeLists reffers to non existing directory - "chiaki_rpi". Once correcting to /home/pi/chiaki/third-party/

                            i get bellow during make in 60%

                            [ 60%] Building CXX object gui/CMakeFiles/chiaki.dir/src/main.cpp.o
                            In file included from /home/pi/chiaki/gui/include/videodecoder.h:38,
                                             from /home/pi/chiaki/gui/include/streamsession.h:28,
                                             from /home/pi/chiaki/gui/include/streamwindow.h:23,
                                             from /home/pi/chiaki/gui/src/main.cpp:6:
                            /home/pi/chiaki/gui/include/pihwdecode.h:9:10: fatal error: Limelight.h: Nie ma takiego pliku ani katalogu
                             #include "Limelight.h"  // from moonlight
                                      ^~~~~~~~~~~~~
                            compilation terminated.
                            make[2]: *** [gui/CMakeFiles/chiaki.dir/build.make:73: gui/CMakeFiles/chiaki.dir/src/main.cpp.o] Błąd 1
                            make[1]: *** [CMakeFiles/Makefile2:442: gui/CMakeFiles/chiaki.dir/all] Błąd 2
                            make: *** [Makefile:163: all] Błąd 2
                            
                            

                            You likely need to add the --recursive flag to your git checkout. I have no idea how to read these errors either. What are they in English?

                            1 Reply Last reply Reply Quote 0
                            • RedMarsBlueMoonR
                              RedMarsBlueMoon
                              last edited by RedMarsBlueMoon

                              Sorry about these I'm still inexperienced in doing code stuff that also works for other people! :)

                              I have made a fix for a noob mistake with some absolute paths that were specifc to my system. I tried compiling with the new relative paths. (still not the official way of doing this but I'd have to figure that one out)

                              I made a git 'issue' thread here that we can continue to chat in so we don't spam this one too much.

                              https://github.com/Fredrum/test_01/issues/1

                              You could re-clone for the update in
                              gui/CMakeLists.txt (only one file got updates) or maybe just re-download that file.

                              I want to get this working for you so please keep letting me know if it still doesn't?

                              Cheers
                              Fred

                              RedMarsBlueMoonR 1 Reply Last reply Reply Quote 0
                              • RedMarsBlueMoonR
                                RedMarsBlueMoon @RedMarsBlueMoon
                                last edited by RedMarsBlueMoon

                                Hi @b4zyl as the PS4 is very soon transitioning into being a retro machine Iv'e got a new version going of this that should be much easier to get running.

                                Iv'e tested this a couple of times on completely fresh Raspbian installs.

                                https://github.com/Fredrum/chiaki/wiki/Chiaki-for-the-Raspberry-Pi

                                If you still run into problems just post on the new git repo's 'issues' section.
                                If anyone has this running in 1080p mode on a PS4 Pro I'd love to hear!

                                1 Reply Last reply Reply Quote 0
                                • D
                                  domb84 @b4zyl
                                  last edited by

                                  @b4zyl Same issue here when using the fork

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    domb84 @b4zyl
                                    last edited by domb84

                                    @b4zyl said in Help: Compiling Chiaki - PS4 remote play:

                                    Awesome guys! Really appreciate your work !

                                    I own PS4 Pro, followed your guide and build Chiaki based on https://github.com/zerojay/chiaki fork. Streaming works fine on Pi4 2GB (30FPS; 720p) but without sound.

                                    When i follow Qt5.12 workaround:

                                    set(Qt5Core_DIR "/usr/lib/qt5.12/lib/cmake/Qt53DCore")
                                    set(Qt5_DIR "/usr/lib/qt5.12/lib/cmake/Qt5")
                                    set(QT_QMAKE_EXECUTABLE "/usr/lib/qt5.12/bin/qmake")

                                    adding to CMakeLists.txt and create new build i got error when trying run Chiaki :

                                    "* failed to add service - already in use?"

                                    any idea whats wrong? I put new set line on the begining of CMakeList.txt file.

                                    I get the same issue on RetroPie building these. Always get:

                                     failed to add service - already in use?
                                    

                                    Created a quick build script, but can't get to launch currently.

                                    # install dependencies
                                    sudo apt install cmake python3-protobuf protobuf-compiler libopus-dev libsdl2-dev libssl-dev -y
                                    
                                    # pull Qt5.12 and install
                                    cd /tmp
                                    wget https://github.com/koendv/qt5-opengl-raspberrypi/releases/download/v5.12.5-1/qt5-opengl-dev_5.12.5_armhf.deb
                                    sudo apt install ./qt5-opengl-dev_5.12.5_armhf.deb -y
                                    
                                    # clone rpi branch of chiaki
                                    cd /home/pi
                                    git clone --single-branch --branch rpi01 https://github.com/Fredrum/chiaki.git chiaki
                                    cd chiaki
                                    # can be a bit slow
                                    git submodule update --init
                                    
                                    # qt5.12 audio fix - tested with and without these paths and results in the same
                                    # echo "set(Qt5Core_DIR "/usr/lib/qt5.12/lib/cmake/Qt53DCore")" >> /home/pi/chiaki/gui/CMakeLists.txt
                                    # echo "set(Qt5_DIR "/usr/lib/qt5.12/lib/cmake/Qt5")" >> /home/pi/chiaki/gui/CMakeLists.txt
                                    # echo "set(QT_QMAKE_EXECUTABLE "/usr/lib/qt5.12/bin/qmake")" >> /home/pi/chiaki/gui/CMakeLists.txt
                                    
                                    # build
                                    mkdir build
                                    cd build
                                    cmake -DCMAKE_PREFIX_PATH=/usr/lib/qt5.12 ..
                                    make
                                    
                                    # add custom ports launcher
                                    cat <<EOF > /home/pi/RetroPie/roms/ports/RemotePS4.sh
                                    #!/bin/bash
                                    /home/pi/chiaki/build/gui/chiaki
                                    EOF
                                    chmod +x /home/pi/RetroPie/roms/ports/RemotePS4.sh
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • D
                                      domb84
                                      last edited by domb84

                                      @zerojay I fixed this in the end and used the original source. I've created a bash script to compile it and add it to RetroPie as a port

                                      Compile chiaki for RetroPie

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        domb84
                                        last edited by

                                        @domb84 finally resolved the audio issues for this as well. You need to revert to the legacy audio options in RetroPie, ie pulseaudio.

                                        Final script here works.

                                        https://dominicbird.com/knowledge-base-2/emulation/compile-chiaki-and-add-as-a-custom-port-to-retropie

                                        RedMarsBlueMoonR S 2 Replies Last reply Reply Quote 0
                                        • RedMarsBlueMoonR
                                          RedMarsBlueMoon @domb84
                                          last edited by RedMarsBlueMoon

                                          Just a note that I'm not having any trouble with the audio after upgrading my system to the new PulseAudio default.
                                          So for me it was working with both Alsa previously and now PulseAudio.

                                          D 1 Reply Last reply Reply Quote 0
                                          • D
                                            domb84 @RedMarsBlueMoon
                                            last edited by domb84

                                            @redmarsbluemoon I've put all the info in the script and I did file a bug with logs but I just ended up configuring pulseaudio. Not sure what the issue with alsa is.

                                            https://github.com/thestr4ng3r/chiaki/issues/397

                                            Do you have any information on hot keys etc? There's no docs that I can find and since I've made a custom port I can launch it but can't quit unless i just 'killall chaiki' via ssh.

                                            Also, I'm not sure if there are supposed to be any menus within chiaki, but nothing renders, I just get black boxes if I right click. You can't connect to a session using a controller either (works great in the session). So I have to have at least a mouse attached to the Pi which I don't normally.

                                            RedMarsBlueMoonR 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.