matanui159 / ReplaySorcery

An open-source, instant-replay solution for Linux
GNU General Public License v3.0
854 stars 27 forks source link

Can't save replay on RX 5700 XT with Hardware Acceleration #123

Closed krasmazov483 closed 3 years ago

krasmazov483 commented 3 years ago

Describe the bug I can't seem to be able to save a replay with my RX 5700 XT when using hwaccel or kms_service. Trying to save from the terminal gives an error as shown below. Is there something missing from my system?

Desktop:

Configuration: /etc/replay-sorcery.conf: replay-sorcery.txt

~/.config/replay-sorcery.conf: replay-sorcery.txt

Sorry for the it being .txt, GitHub says it doesn't support .conf files.

Logs: The log file is only saving the contents of replay-sorcery from when I didn't have it running as replay-sorcery-kms. Here is how it shows in my terminal (I first tried only replay-sorcery just to see if it was working):

 jojo@jojo-solus  ~  replay-sorcery
Real user ID: 1000
Effective user ID: 1000
Reading config file '/etc/replay-sorcery.conf'...
Setting 'logLevel' to 'info'...
Setting 'traceLevel' to 'error'...
Setting 'recordSeconds' to '30'...
Setting 'videoInput' to 'auto'...
Setting 'videoDevice' to 'auto'...
Setting 'videoX' to '0'...
Setting 'videoY' to '0'...
Setting 'videoWidth' to 'auto'...
Setting 'videoHeight' to 'auto'...
Setting 'videoFramerate' to '30'...
Setting 'videoEncoder' to 'auto'...
Setting 'videoProfile' to 'baseline'...
Setting 'videoPreset' to 'fast'...
Setting 'videoQuality' to '28'...
Setting 'videoBitrate' to 'auto'...
Setting 'videoGOP' to '30'...
Setting 'scaleWidth' to 'auto'...
Setting 'scaleHeight' to 'auto'...
Setting 'audioInput' to 'auto'...
Setting 'audioDevice' to 'auto'...
Setting 'audioSamplerate' to '44100'...
Setting 'audioEncoder' to 'auto'...
Setting 'audioProfile' to 'low'...
Setting 'audioBitrate' to 'auto'...
Setting 'controller' to 'auto'...
Setting 'keyName' to 'r'...
Setting 'keyMods' to 'ctrl+super'...
Setting 'outputFile' to '~/Videos/ReplaySorcery/%F_%H-%M-%S.mp4'...
Setting 'outputCommand' to 'notify-send ReplaySorcery "Saved replay as %s"'...
Reading config file '/home/jojo/.config/replay-sorcery.conf'...
Setting 'videoWidth' to 'auto'...
Setting 'videoHeight' to 'auto'...
Setting 'scaleWidth' to 'auto'...
Setting 'scaleHeight' to 'auto'...
Setting 'scaleWidth' to 'auto'...
Setting 'scaleHeight' to 'auto'...
Setting 'videoInput' to 'hwaccel'...
Setting 'videoDevice' to 'auto'...
Setting 'videoFramerate' to '30'...
Setting 'recordSeconds' to '30'...
Setting 'videoEncoder' to 'vaapi_hevc'...
Setting 'videoProfile' to 'baseline'...
Setting 'videoPreset' to 'fast'...
Setting 'videoQuality' to '25'...
Setting 'videoBitrate' to 'auto'...
Setting 'videoGOP' to '30'...
Setting 'audioInput' to 'auto'...
Setting 'audioDevice' to 'auto'...
Setting 'audioEncoder' to 'auto'...
Setting 'audioProfile' to 'low'...
Setting 'audioSamplerate' to '48000'...
Setting 'audioBitrate' to 'auto'...
Setting 'keyMods' to 'ctrl+super'...
Setting 'keyName' to 'r'...
Setting 'outputCommand' to 'outputCommand = notify-send ReplaySorcery -i /usr/share/icons/hicolor/128x128/apps/goverlay.png "Saved replay as %s"'...
Setting 'outputFile' to '/home/jojo/Videos/Replays/%F_%H-%M-%S.mp4'...
ReplaySorcery  Copyright (C) 2020-2021  ReplaySorcery developers
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see COPYING for details.
FFmpeg version: 4.4
Created KMS service device
[hevc_vaapi @ 0x22fcb00] Filter graph: hwmap=derive_device=vaapi,crop=2560:1080:0:0,scale_vaapi=2560:1080:nv12
[hevc_vaapi @ 0x22fcb00] Driver does not support some wanted packed headers (wanted 0xd, found 0x1).
[hevc_vaapi @ 0x22fcb00] Quality attribute is not supported: will use default quality level.
PulseAudio server: PulseAudio (on PipeWire 0.3.33) 15.0.0
Connecting to Pulse Audio device: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor...
Created PulseAudio device
X11 version: 11.0
X11 vendor: The X.Org Foundation v12013000
Created X11 controller
^Z
[1]  + 3574 suspended  replay-sorcery
 ✘ ⚙ jojo@jojo-solus  ~  replay-sorcery save                                             
Real user ID: 1000
Effective user ID: 1000
Failed to connect socket: No such file or directory
 - (null):0 (av_log)
 - (null):0 (main)
 - (null):0 (__libc_start_main)
No such file or directory
 - (null):0 (av_log)
 - (null):0 (main)
 - (null):0 (__libc_start_main)
matanui159 commented 3 years ago

You're using the X11 controller. To use replay-sorcery save you need to set controller = command in your config file and restart.

krasmazov483 commented 3 years ago

Sorry for the late response. Unfortunately it did not work, now it shows a similar error, but says the connection is refused:

Real user ID: 1000
Effective user ID: 1000
Failed to connect socket: Connection refused
 - (null):0 (av_log)
 - (null):0 (main)
 - (null):0 (__libc_start_main)
Connection refused
 - (null):0 (av_log)
 - (null):0 (main)
 - (null):0 (__libc_start_main)

I also forgot to mention in the original post, but it also doesn't work with the keybind that's set on the config file with hwaccel, it simply doesn't save anything.

EDIT: After another restart the old error is back:

Real user ID: 1000
Effective user ID: 1000
Failed to connect socket: No such file or directory
 - (null):0 (av_log)
 - (null):0 (main)
 - (null):0 (__libc_start_main)
No such file or directory
 - (null):0 (av_log)
 - (null):0 (main)
 - (null):0 (__libc_start_main)

EDIT 2: Tested on both X11 and Wayland, same error on both.

matanui159 commented 3 years ago

The keybinding (X11 controller that it is set to by default) is not supported on Wayland. Can you share the logs of replay-sorcery after setting controller = command?

matanui159 commented 3 years ago

Also can you try latest master? There is a fix there for creating directories.

krasmazov483 commented 3 years ago

The keybinding (X11 controller that it is set to by default) is not supported on Wayland. Can you share the logs of replay-sorcery after setting controller = command?

Sure thing, what command should I use? The one provided when creating the issue only populates the log file with the contents of when I had the replay-sorcery service running instead of the replay-sorcery-kms service.

Also can you try latest master? There is a fix there for creating directories.

I'll try it and report back here.

krasmazov483 commented 3 years ago

I encountered an error when building from source at the make -C bin step:

[ 74%] Building C object CMakeFiles/replay-sorcery.dir/src/device/ffdev.c.o
[ 76%] Building C object CMakeFiles/replay-sorcery.dir/src/device/kmsdev.c.o
[ 79%] Building C object CMakeFiles/replay-sorcery.dir/src/device/svkmsdev.c.o
[ 81%] Building C object CMakeFiles/replay-sorcery.dir/src/device/x11dev.c.o
In file included from /home/jojo/ReplaySorcery/src/device/x11dev.c:20:
/home/jojo/ReplaySorcery/src/device/x11dev.h:43:44: error: unknown type name ‘uint32_t’
   43 | int rsXClientGetKeyCode(RSXClient *client, uint32_t sym);
      |                                            ^~~~~~~~
/home/jojo/ReplaySorcery/src/device/x11dev.c: In function ‘xclientError’:
/home/jojo/ReplaySorcery/src/device/x11dev.c:27:9: error: ‘XCB_CONN_ERROR’ undeclared (first use in this function)
   27 |    case XCB_CONN_ERROR:
      |         ^~~~~~~~~~~~~~
/home/jojo/ReplaySorcery/src/device/x11dev.c:27:9: note: each undeclared identifier is reported only once for each function it appears in
/home/jojo/ReplaySorcery/src/device/x11dev.c:29:9: error: ‘XCB_CONN_CLOSED_EXT_NOTSUPPORTED’ undeclared (first use in this function)
   29 |    case XCB_CONN_CLOSED_EXT_NOTSUPPORTED:
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jojo/ReplaySorcery/src/device/x11dev.c:31:9: error: ‘XCB_CONN_CLOSED_MEM_INSUFFICIENT’ undeclared (first use in this function)
   31 |    case XCB_CONN_CLOSED_MEM_INSUFFICIENT:
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jojo/ReplaySorcery/src/device/x11dev.c:33:9: error: ‘XCB_CONN_CLOSED_REQ_LEN_EXCEED’ undeclared (first use in this function)
   33 |    case XCB_CONN_CLOSED_REQ_LEN_EXCEED:
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jojo/ReplaySorcery/src/device/x11dev.c:35:9: error: ‘XCB_CONN_CLOSED_PARSE_ERR’ undeclared (first use in this function)
   35 |    case XCB_CONN_CLOSED_PARSE_ERR:
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/jojo/ReplaySorcery/src/device/x11dev.c:37:9: error: ‘XCB_CONN_CLOSED_INVALID_SCREEN’ undeclared (first use in this function)
   37 |    case XCB_CONN_CLOSED_INVALID_SCREEN:
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jojo/ReplaySorcery/src/device/x11dev.c: At top level:
/home/jojo/ReplaySorcery/src/device/x11dev.c:101:5: warning: no previous prototype for ‘rsXClientGetKeyCode’ [-Wmissing-prototypes]
  101 | int rsXClientGetKeyCode(RSXClient *client, uint32_t sym) {
      |     ^~~~~~~~~~~~~~~~~~~
/home/jojo/ReplaySorcery/src/device/x11dev.c:25:12: warning: ‘xclientError’ defined but not used [-Wunused-function]
   25 | static int xclientError(int error) {
      |            ^~~~~~~~~~~~
make[2]: *** [CMakeFiles/replay-sorcery.dir/build.make:440: CMakeFiles/replay-sorcery.dir/src/device/x11dev.c.o] Error 1
make[2]: Leaving directory '/home/jojo/ReplaySorcery/bin'
make[1]: *** [CMakeFiles/Makefile2:138: CMakeFiles/replay-sorcery.dir/all] Error 2
make[1]: Leaving directory '/home/jojo/ReplaySorcery/bin'
make: *** [Makefile:136: all] Error 2
make: Leaving directory '/home/jojo/ReplaySorcery/bin'

I didn't include the whole output because it would make the comment extremely large. But it seems to always give me an error at 81% on x11dev.c.o.

matanui159 commented 3 years ago

Sure thing, what command should I use? The one provided when creating the issue only populates the log file with the contents of when I had the replay-sorcery service running instead of the replay-sorcery-kms service.

If you're running it as a service you can use journalctl --user -eu replay-sorcery to get the logs.

I encountered an error when building from source at the make -C bin step:

Master currently requires libxcb (+dev headers) to be installed.

krasmazov483 commented 3 years ago

If you're running it as a service you can use journalctl --user -eu replay-sorcery to get the logs.

That's the one I tried, but it would only show the entries from yesterday before I started using replay-sorcery-kms, which is also before I added controller = command in the config file: replay-sorcery.log

I tried a few different things that ended in an empty log file, and eventually found that using sudo journalctl --system -eu replay-sorcery-kms -n 100 > replay-sorcery.log actually created a log file with more recent entries, but I don't know if it have any useful info there: replay-sorcery.log

Master currently requires libxcb (+dev headers) to be installed.

I do have both libxcb and the devel package installed on my system from the Solus repos, maybe I'm missing some package as it should be possible for me to build it from source since the latest release is available to install on the repos too, unless libxcb is only required on the master branch, in which case it might be that there really isn't something in Solus currently that would let me build it.

EDIT: Nevermind, I found the package, it was libx11-devel in the Software Center. I'll test it.

krasmazov483 commented 3 years ago

WIth the master branch installed only hwaccel with default video encoder seems to be working for me, but I still cannot save, gives me the same error on the terminal:

Real user ID: 1000
Effective user ID: 1000
Failed to connect socket: No such file or directory
 - (null):0 (av_log)
 - (null):0 (main)
 - (null):0 (__libc_start_main)
No such file or directory
 - (null):0 (av_log)
 - (null):0 (main)
 - (null):0 (__libc_start_main)

Log: replay-sorcery.log

The Ctrl + Meta + R keybind also doesn't work. (I made a shortcut on System Settings as instructed on the readme, since I'm using controller = command).

matanui159 commented 3 years ago

I need to see the main replay-sorcery service logs.

That's the one I tried, but it would only show the entries from yesterday before I started using replay-sorcery-kms, which is also before I added controller = command in the config file: replay-sorcery.log

According to these logs the replay-sorcery service is not currently running. You need to have both it and the replay-sorcery-kms services running (with the user service started after the KMS service). Try running systemctl --user restart replay-sorcery.

krasmazov483 commented 3 years ago

According to these logs the replay-sorcery service is not currently running. You need to have both it and the replay-sorcery-kms services running (with the user service started after the KMS service). Try running systemctl --user restart replay-sorcery.

Got it, it should be correct now then: replay-sorcery.log

krasmazov483 commented 3 years ago

Looks like I finally got it to work.

In the log I attached above it gave and error about PulseAudio so I installed the devel package for it and reinstalled so the error is gone.

But it turns out I'm just dumb, I thought that I only needed either the replay-sorcery service or the replay-sorcery-kms service running at once, not both. With both running, even the latest stable release is working with hardware acceleration. I'm sorry for taking your time with this issue. It might be a good idea to update the readme so other people doesn't end misinterpreting it like me.

Thank you for you patience and for trying to help me.