Fredrum / chiaki

Raspberry Pi fork of the Free and Open Source PS4 and PS5 Remote Play client Chiaki.
https://github.com/Fredrum/chiaki/wiki/rpi02---branch-for-Bullseye,-64bit,-h265-and-kmsdrm
GNU Affero General Public License v3.0
67 stars 11 forks source link

Unable to open stream #33

Closed JeremyLJordan closed 1 year ago

JeremyLJordan commented 2 years ago

Device: RPi 4 B+ OS: Raspbian Bullseye 5.15.32-v7l+ Chiaki Version 2

I am having an issue getting my stream to start and i feel confident it is due to something with the change in dtoverlay. I have followed the tutorial verbatum and did troubleshooting by changing dtoverlay between:

  1. vc4-kms-v3d
  2. vc4-fkms-v3d
  3. rpivid-v4l2 (which i know is the correct one for my model)

I get a segmentation fault on both 2 and 3 that outputs to the terminal like so:

Linux base Path: /home/pi/chiaki-rpi/build/rpi/chiaki-rpi'�Ĭ��� SDL version linked: 2.0.20 Disp Mode: 1920x1080px @ 0hz SDL_VIDEO_DRIVER selected: x11 Segmentation fault

I can launch the UI using number 1, but when the stream tries to open I get the following

Linux base Path: /home/pi/chiaki-rpi/build/rpi/chiaki-rpi���L�� SDL version linked: 2.0.20 Disp Mode: 1920x1080px @ 60hz SDL_VIDEO_DRIVER selected: x11 SDL_RENDER_DRIVER selected: opengles2 Running under X11: 1 INFO: Audio device 0: Built-in Audio Analog Stereo INFO: Audio device 1: Built-in Audio Digital Stereo (HDMI) Rpi IO created END HostInit Gamepads currently attached: 0 Check the gamepad is properly connected Will try to read rpi settings file: /home/pi/.config/Chiaki/Chiaki_rpi.conf Found settings for 1 host(s) Discovery Service started GL_VERSION : OpenGL ES 3.1 Mesa 20.3.5 GL_RENDERER : V3D 4.2 Gui init done Discovered Host State: ready Discovery ID match Host Click Starting Play session! SDL drm_fd: 33554460 Segmentation fault

I attempted to revert to chiaki v1, but I am unable to register my device because there is no longer a PIN when registering.

Any help would be appreciated.

Fredrum commented 2 years ago

Hi! Thanks for adding the Info on what system you are trying to get to work!

So I'm focusing on your second larger block of output. I just tried downloading and building again on my RPiOS sd card and it worked with that si we should try to see what you're trying to do that's different.

I see you have 5.15.32-v7l+ which I believe means 32bit. Is that correct? It should work w 32 bit though.

Do you have a PS4 or PS5?

Fredrum commented 2 years ago

When I start a stream I get a valid looking _SDL drmfd: which for some reason you don't.

My successful stream startup looks like this,

Found settings for 1 host(s)
Gui init done
Gamepad added
Controller is:  PS4 Controller
Host Click
Starting Play session!
SDL drm_fd:  85
[h264_v4l2m2m @ 0x5596288b00] level=-99
[h264_v4l2m2m @ 0x5596288b00] Using device /dev/video10
[h264_v4l2m2m @ 0x5596288b00] driver 'bcm2835-codec' on card 'bcm2835-codec-decode' in mplane mode
[h264_v4l2m2m @ 0x5596288b00] requesting formats: output=H264 capture=YU12
Actual Fmt: 181
Finish InitFFmpeg
END chiaki session start
Init Audio CB
ConnectionEventCB() CHIAKI_EVENT_CONNECTED
Starting Play Thread
Connected Setsu Motion Device /dev/input/event2
Connected Setsu Touchpad Device /dev/input/event0

I would have to flash a new SD card to see if I can replicate your error.

Fredrum commented 2 years ago

Arr I found a bug/mistake that thought I had fixed but apparently not.

Could you please try in your chiaki-rpi folder do, git pull

then do the make again? You should not need to re-register.

if not you'll need to re-do the 'git clone' step then the build steps. (but not register)

JeremyLJordan commented 2 years ago

Arr I found a bug/mistake that thought I had fixed but apparently not.

Could you please try in your chiaki-rpi folder do, git pull

then do the make again? You should not need to re-register.

if not you'll need to re-do the 'git clone' step then the build steps. (but not register)

doing this now. standby

JeremyLJordan commented 2 years ago

That didn't seem to change anything. I also attempted to resolve this issue after my first attempt, where should this point to?

error: XDG_RUNTIME_DIR not set in the environment.

I'll wipe the sd card and try again, what version of raspbian are you using with the version? I'll just use that

JeremyLJordan commented 2 years ago

Do you have a PS4 or PS5?

PS5

Fredrum commented 2 years ago

Hm I have just now tried on both 32 and 64 bit regular RPiOS Bullseye's. Apart from the fix I just did, which was caused by bad resolve of absent rpivid-v4l2 device, it woked on both for me. I only have an PS4 to test with though but It worked not long ago with my brothers PS5.

I wouldn't bother re-flashing the OS if you've got a standard Raspberry OS install.

The new error message where does that show up? error: XDG_RUNTIME_DIR not set in the environment

Have you got the standard Desktop? Window manager etc?

You could also try starting chiaki just from the tty/cli screen. That would tell us a bit more if it works or doesn't threre too.

P.s I was going to try to get it to work on Retropie today. The issue with that is that it's using Buster and not Bullseye.

Fredrum commented 2 years ago

To start from the tty, if you are currently on the Desktop,

  1. Press Ctrl + Alt + F3
  2. cd to chiaki/build
  3. Run as usual, rpi/chiaki-rpi
JeremyLJordan commented 2 years ago

I rebuilt with the lite version (console only) and followed all of the steps. I was able to launch it for cli. I copied my Config file over ssh and the segmentation fault happened again. It appears the directory /.config/Chiaki/ is not being created with the install. Might be something to look at. I deleted the config file and got the segmentation fault still, so I'm going to try re-registering it with a fresh build. I'll let you know.

Fredrum commented 2 years ago

If you still get the crash after that I will try again on a fresh RaspiOS card.

And just to check you are using these instructions now?

https://github.com/Fredrum/chiaki/wiki/rpi02---branch-for-Bullseye,-64bit,-h265-and-kmsdrm

JeremyLJordan commented 2 years ago

If you still get the crash after that I will try again on a fresh RaspiOS card.

And just to check you are using these instructions now?

https://github.com/Fredrum/chiaki/wiki/rpi02---branch-for-Bullseye,-64bit,-h265-and-kmsdrm

yes, I'm almost done rebuilding. Again, I switched to the lite version. The only dependency that I had to manually add was "git".

JeremyLJordan commented 2 years ago

for clarification with the ps5, does "dtoverlay=" need to be added to the config or does it need to replace the entry that is already there (vc4-kms-v3d)? so should it be dtoverlay=vc4-kms-v3d dtoverlay=rpivid-v4l2

or

dtoverlay=vc4-kms-v3d, rpivid-v4l2

or just

dtoverlay=rpivid-v4l2

Fredrum commented 2 years ago

If you want to use h265, which you probably do, your config.txt should have something looking like,

dtoverlay=vc4-kms-v3d dtoverlay=rpivid-v4l2

JeremyLJordan commented 2 years ago

Okay, and I've verified that the config file is not being created. I tried to reregister and got the following error. I do have the GUI up from the cli though

Host Click Opening Register Dialog AccID entered: (REDACTED)== Regist Target: 1000100 PIN int: 32 Host Addr: 192.168.10.13 END RegistClick In host RegistEventCB Registration fail

Fredrum commented 2 years ago

Hm so you are getting this error from the tty/cli register?

But you managed to register previously from the Desktop, is that correct?

Just to tackle one problem at a time if you can I would use your previous register .conf file if you feel that one worked?

You should have seen a icon with a PS5 image and a blue or orange light.

JeremyLJordan commented 2 years ago

Yes, the error is from the cli. When I dropped my previous config it gives the segmentation fault, but it did work for a second in the past.

Should I manually add the /.config/chiaki/ folder and chown it to pi?

JeremyLJordan commented 2 years ago

I'm wondering if the registration fail error is due to not being able to write to the config file since the folder doesnt exist.

Fredrum commented 2 years ago

There hasn't been a problem with the folder when registering a PS4, so far. The folder gets created when it needs to be. But if one is copying then one would have to create the folder.

it needs to have a big 'C' in Chiaki

I am now going to flash a Lite 64bit Bullseye RPiOS card an install from scratch.

JeremyLJordan commented 2 years ago

Thanks, let me know. My internet just went down so I won't able to test anything for a bit.

On Sun, Jun 5, 2022, 6:08 PM Blueroom VR @.***> wrote:

There hasn't been a problem with the folder when registering a PS4, so far. The folder gets created when it needs to be. But if one is copying then one would have to create the folder.

it needs to have a big 'C' in Chiaki

I am now going to flash a Lite 64bit Bullseye RPiOS card an install from scratch.

— Reply to this email directly, view it on GitHub https://github.com/Fredrum/chiaki/issues/33#issuecomment-1146900160, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZJICRCSSTICIBFDHFD6MDVNUXOLANCNFSM5X5NHZ7A . You are receiving this because you authored the thread.Message ID: @.***>

Fredrum commented 2 years ago

So I just flashed a fresh Raspberry OS 64bit Bullseye 'Lite' card. Followed the instructions. Registered again. (ie didn't copy old regist)

And it worked fine. :P

So not sure what's different for you apart from using a PS5. Apart from triple checking your PSN Account ID and PIN I don't know what to do here since I don't have my own PS5. The only thing would be to see if my brother could do another test but I can't say when that could happen.

I noticed you had 10 in your PS5 ip address third group. Is there anything non-straight forward with your networking setup? Between your RPi and your PS5?

JeremyLJordan commented 2 years ago

Thank you for trying. I'll keep playing with it. The network isn't crazy, just a switch and router. I must be doing something wrong if it worked for you.

Thanks for keeping this repo up!

Fredrum commented 2 years ago

I'll try and see if my brother is up for another test and I'll post back if that happens! Btw I have a switch and router too.

JeremyLJordan commented 2 years ago

I think my config file was corrupt or there was an encoding problem on my end. I was able to recreate it in the terminal and now I am able to get to the GUI continuously. I'm still not getting output on the screen though. It just goes to a black screen Here is the terminal output

SDL version linked: 2.0.20 Disp Mode: 1920x1080px @ 60hz SDL_VIDEO_DRIVER selected: KMSDRM SDL_RENDER_DRIVER selected: opengles2 Running under X11: 0 INFO: Audio device 0: bcm2835 Headphones, bcm2835 Headphones INFO: Audio device 1: vc4-hdmi-0, MAI PCM i2s-hifi-0 INFO: Audio device 2: vc4-hdmi-1, MAI PCM i2s-hifi-0 Rpi IO created END HostInit Gamepads currently attached: 0 Check the gamepad is properly connected Will try to read rpi settings file: /home/pi/.config/Chiaki/Chiaki_rpi.conf Found settings for 1 host(s) Discovery Service started GL_VERSION : OpenGL ES 3.1 Mesa 20.3.5 GL_RENDERER : V3D 4.2 Gui init done Discovered Host State: ready Discovery ID match

here are my options in the UI

Video Decoder: Automatic, V41.2 Video Codec: Automatic, H264, H265 Framerate: 30,60 Audio Out: BCM2835 Headphones, VC4-HDMI-0, VC4-HDMI-1

I've tried most of the combinations and get the same result.

Jeramo commented 2 years ago

I am having some issues with Chiaki for Raspberry Pi 4b,

Linux base Path: /home/pi/chiaki-rpi/build/rpi/chiaki-rpi��� ��� SDL version linked: 2.0.20 Disp Mode: 4096x2160px @ 60hz SDL_VIDEO_DRIVER selected: x11 SDL_RENDER_DRIVER selected: opengles2 Running under X11: 1 INFO: Audio device 0: Inbyggt ljud Analog Stereo INFO: Audio device 1: Inbyggt ljud Digital Stereo (HDMI) Rpi IO created END HostInit Gamepads currently attached: 0 Check the gamepad is properly connected Will try to read rpi settings file: /home/pi/.config/Chiaki/Chiaki_rpi.conf Found settings for 1 host(s) Discovery Service started GL_VERSION : OpenGL ES 3.1 Mesa 20.3.5 GL_RENDERER : V3D 4.2 Gui init done Discovered Host State: ready Discovery ID match

I tried all different settings, such as: Video Decoder: Automatic Video Codec: both H264 and H265 Resolutio: both 720 and 1080p Framerate: 60

And I set the config.txt to: dtoverlay=vc4-kms-v3d dtoverlay=rpivid-v4l2

However, it seems to run fine for half a second, then it all crashes. I tried to set the graphics memory to 128 MB but to no avail. I am connected through Ethernet.

Something that might be good to know is that I had to create the path for the Chiaki_rpi.conf-file by my self since the application didn't do that.

JeremyLJordan commented 2 years ago

I am having some issues with Chiaki for Raspberry Pi 4b,

Are you using a PS4 or PS5?

Fredrum commented 2 years ago

Hi You could try again now if you want. My latest bug fixes should hopefully have helped a lot.

I'd suggest to use not a 'Lite' Raspberr OS image. You can switch to tty playing on any of them later.

If you want to try, re git clone + re-build + probably re-register.

JeremyLJordan commented 2 years ago

Hi You could try again now if you want. My latest bug fixes should hopefully have helped a lot.

I'd suggest to use not a 'Lite' Raspberr OS image. You can switch to tty playing on any of them later.

If you want to try, re git clone + re-build + probably re-register.

I'll do That this weekend. What was the issue?

Fredrum commented 2 years ago

I think it might be these, https://github.com/Fredrum/chiaki/issues/34#issuecomment-1149430123

There might still be problems with h265 and I didn't get enough info from the other user to figure that out. So if you do test, would you please be able to try both h264 and h265?

JeremyLJordan commented 2 years ago

Sure, I'm going to do it now. Can you tell me what you want me to put in my config file so I don't do it incorrectly and set you back?

Fredrum commented 2 years ago

You shouldn't have to do anything by hand with the config file. In the GUI start with,

h264 720 60 [Select an Audio Device]

JeremyLJordan commented 2 years ago

Auto gave me this

AVERROR(EAGAIN) [hevc @ 0x55a078a280] Invalid NAL unit 32, skipping.

V4L2, h264, 720, 60, HDMI- Audio is working great with the exception of audio. I'll troubleshoot that and see if I can fix it. still throwing a few of these in the beginning though.

AVERROR(EAGAIN) AVERROR(EAGAIN) AVERROR(EAGAIN) AVERROR(EAGAIN) AVERROR(EAGAIN) AVERROR(EAGAIN)

V4L2, h265, 720, 60, HDMI audio gives the same as auto

AVERROR(EAGAIN) [hevc @ 0x55a078a280] Invalid NAL unit 32, skipping.

JeremyLJordan commented 2 years ago

I've tried every audio output and cant get sound. but its streaming great other than that.

Running under X11: 0 INFO: Audio device 0: bcm2835 Headphones, bcm2835 Headphones INFO: Audio device 1: Wireless Controller, USB Audio INFO: Audio device 2: vc4-hdmi-0, MAI PCM i2s-hifi-0 INFO: Audio device 3: vc4-hdmi-1, MAI PCM i2s-hifi-0

Fredrum commented 2 years ago

Cool thanks. The AVERROR(EAGAIN) in the beginning is normal. It's the first packets before you have a full frame.

So No Audio at all? Did you get any Audio devices in the bottom pop-up menu? EDIT: Sorry just saw you new message.

Fredrum commented 2 years ago

Ok. I will have to wait until I get time on Saturday evening and I will try and see if I get audio. I currently have it not connected. Thanks for testing and great that we're getting closer.

BTW, you should now be able to try 1080 resolution.

JeremyLJordan commented 2 years ago

for sure. Thanks again. Let me know if you want me to try anything else.

i was able to get it to work on 1080

Edit: I have no audio anywhere. I'm going to flashback to the desktop version and will update this if it works fine.

Edit2: Flashed to the desktop of Raspbian, installed everything, and got a segmentation fault again. I removed the h.265 entry in the boot.config and still got the segmentation fault.

JeremyLJordan commented 2 years ago

If I could get sound on lite my issue would mostly be resolved. While I still have the desktop version still flashed are there some logs or anything I can help with your efforts in h265?

Fredrum commented 2 years ago

Hi yes for h265 we/you could try running with the debugger 'gdb' and that could give me some hints, like this:

gdb rpi/chiaki-rpi then enter command run then after the crash do this command for backtrace bt Then paste all of the output here.

For the sound I really have no idea how to test that further. Iv'e done a few more test runs here with my Pi4b and PS4 and I get sound every time. One thing I could try is actually to test the sound output on my 'Lite' os sd card as last I tried is was the full fat OS.

I'll take a look again and see if I can add some more printouts that could help.

JeremyLJordan commented 2 years ago

The sound issue is not with chiaki it's definitely an issue with raspbian on the pi4 so unless you just want to solve that problem to help, its not really your issue but I appreciate you either way.

I'll output the logs for you tomorrow and update you.

Fredrum commented 2 years ago

Ok thank you, maybe I don't know at this point. I wish I could get hold of a PS5 at retail price but I just can't justify to buy at scalp prices. :P

Thanks, before you start tomorrow, make sure to do a, git pull To get the latest fixes I did the other day.

I just tried with my 'Lite' card install and the sound was working. So unless I have something wrong in my code that breaks it with a PS5...

Fredrum commented 2 years ago

actually, ontop of the gdb debug check there's another thing we could do. If you un-comment this line with the debug, https://github.com/Fredrum/chiaki/blob/2d4c3f6d08e807b567ad070c2a70dc7c4f648c0b/rpi/src/io.cpp#L435

the re-build and run normally you'll get a big pile of extra ffmpeg output. It's possible we could read something out of that.

JeremyLJordan commented 2 years ago

Sorry for the delay

pi@raspberrypi:~/chiaki-rpi/build $ gdb rpi/chiaki-rpi GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "aarch64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from rpi/chiaki-rpi... (gdb) run Starting program: /home/pi/chiaki-rpi/build/rpi/chiaki-rpi [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1". Linux base Path: /home/pi/chiaki-rpi/build/rpi/chiaki-rpi h265 Hardware Decoder Detected SDL version linked: 2.0.20

Program received signal SIGSEGV, Segmentation fault. strcmp () at ../sysdeps/aarch64/strcmp.S:64 64 ../sysdeps/aarch64/strcmp.S: No such file or directory. (gdb)

JeremyLJordan commented 2 years ago

I realized I hadn't edited my config file. You caught it before I edited my post. also I forgot to add the backtrace which is here

(gdb) bt

0 strcmp () at ../sysdeps/aarch64/strcmp.S:64

1 0x00000055555a49cc in main() () at /home/pi/chiaki-rpi/rpi/src/main.cpp:67

edit: device 19 does exist now, sorry for the error

Fredrum commented 2 years ago

Hm thanks that was less output than I'd hoped for. But seems to be something with a strcmp so that's something. I wonder if the../sysdeps/aarch64/strcmp.S: No such file or directory. is a clue as that's not something that's part of Chiaki.

If you search your system for that file does it not exist?

cd /
sudo find -name strcmp.S

So is it crashing early now? Do you not get to the gui?

I thought it'd be good to try and do the av_log_set_level(AV_LOG_DEBUG); (not gdb, just normal run) that I mentioned above but we can't of course if its now crashing even before you can start a session.

Fredrum commented 2 years ago

ooof I'm able to properly look a this now after work. I'm also getting that crash now...

UPDATE: Not trying to shift the blame here :) but it seems like its actually a recent update to something in Raspberry OS that is now causing problems with a call to SDL_GetCurrentVideoDriver().

I tested with an older sd card I had that's not been updated for a while and Chiaki works correctly on that. Iv'e put a question to the Raspberry forum so will have to wait and see if anyone knows.

Fredrum commented 1 year ago

Ok it seems to work again. At least it does for me. I did re-run install_sdl.sh but I'm not certain if that was part of it or if something got fixed back in RPi OS (which I still think was the cause).

JeremyLJordan commented 1 year ago

ooof I'm able to properly look a this now after work. I'm also getting that crash now...

UPDATE: Not trying to shift the blame here :) but it seems like its actually a recent update to something in Raspberry OS that is now causing problems with a call to SDL_GetCurrentVideoDriver().

I tested with an older sd card I had that's not been updated for a while and Chiaki works correctly on that. Iv'e put a question to the Raspberry forum so will have to wait and see if anyone knows.

What version, I'll install that and try.

JeremyLJordan commented 1 year ago

Hm thanks that was less output than I'd hoped for. But seems to be something with a strcmp so that's something. I wonder if the../sysdeps/aarch64/strcmp.S: No such file or directory. is a clue as that's not something that's part of Chiaki.

If you search your system for that file does it not exist?

cd /
sudo find -name strcmp.S

So is it crashing early now? Do you not get to the gui?

I thought it'd be good to try and do the av_log_set_level(AV_LOG_DEBUG); (not gdb, just normal run) that I mentioned above but we can't of course if its now crashing even before you can start a session.

pi@raspberrypi:/ $ sudo find -name strcmp.S find: ‘./run/user/1000/gvfs’: Permission denied

Fredrum commented 1 year ago

So I would rerun install_sdl.sh. Then to make sure, re make chiaki.

Then we should be back to before this latest errors, I think. Worked for me. Let me know.

Fredrum commented 1 year ago

I just came back from a trip to the other side of the planet where I could test and fix Chiaki for PS5. The latest current code should now work with PS5 and also h265.

There's still an issue when using h264+tty/cli that causes some video glitching that I need to take a look at and try to fix.

JeremyLJordan commented 1 year ago

You're the best. I'll check it out. Thank you

On Sun, Sep 4, 2022, 2:07 PM Blueroom VR @.***> wrote:

I just came back from a trip to the other side of the planet where I could test and fix Chiaki for PS5. The latest current code should now work with PS5 and also h265.

There's still an issue when using h264+tty/cli that causes some video glitching that I need to take a look at and try to fix.

— Reply to this email directly, view it on GitHub https://github.com/Fredrum/chiaki/issues/33#issuecomment-1236397973, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZJICQ7RZL3B7K5FF4Y6ODV4TXPHANCNFSM5X5NHZ7A . You are receiving this because you authored the thread.Message ID: @.***>