matanui159 / ReplaySorcery

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

Can't get replay sorcery to work on wayland with hwaccel #159

Open Steccah opened 2 years ago

Steccah commented 2 years ago

Describe the bug Replay sorcery service fails to start

Desktop:

Configuration:

# The minimum log-level to show
# Possible values: trace, debug, verbose, info, warning, error, fatal, panic, quiet
# Default value: info
logLevel = info

# The minimum log-level to add stacktraces to
# Possible values: trace, debug, verbose, info, warning, error, fatal, panic, quiet
# Default value: error
traceLevel = error

# The duration of the recording in seconds
# Default value: 30
recordSeconds = 30

# The video input backend to use for video recording
# Possible values: auto, hwaccel, x11, kms, kms_service
# Default value: auto
videoInput = hwaccel

# The name of the input video device
# For kms and kms_service, see `replay-sorcery kms-devices`
# Possible values: auto, or a device string
# Default value: auto
videoDevice = auto

# The X, Y, width and height of recording rectangle
# Default value: 0, 0
videoX = 0
videoY = 0
# Possible values: a positive integer or auto
# Default value: auto, auto
videoWidth = 1920
videoHeight = 1080

# The framerate of the recording
# Default value: 30
videoFramerate = 30

# The video encoder backend to use for video recording
# Possible values: auto, hevc, x264, openh264, x265, vaapi_h264, vaapi_hevc
# Default value: auto
videoEncoder = vaapi_h264

# The H.264 profile to use for video encoding
# Possible values: baseline, main, high
# Default value: baseline
videoProfile = baseline

# A high-level preset for video encoding performance
# Possible values: fast, medium, slow
# Default value: fast
videoPreset = fast

# The quality to use for video encoding, lower is better
# Possible values: 1-51 or auto
# Default value: 28
videoQuality = 28

# The bitrate to use for video encoding
# Possible values: a positive integer ending in an SI prefix (eg. 1M) or auto
# Default value: auto
videoBitrate = auto

# The number of frames between IDR frames
# Default value: 30
videoGOP = 30

# The width and height to scale the video to
# Possible values: a positive integer or auto
# Default value: auto, auto
scaleWidth = auto
scaleHeight = auto

# The audio input backend to use for audio recording
# Possible values: none, auto, pulse
# Default value: auto
audioInput = auto

# The name of the input audio device
# For pulse, see `pactl list sources`
# Possible values: auto, system, or a device string
# Default value: auto
audioDevice = auto

# The samplerate to use for audio recording
# Default value: 44100
audioSamplerate = 44100

# The audio encoder backend to use for audio recording
# Possible values: auto, aac, fdk
# Default value: auto
audioEncoder = auto

# The AAC profile to use for audio encoding
# Possible values: low (LC), main, high (HE)
# Default value: low
audioProfile = low

# The bitrate to use for audio encoding
# Possible values: a positive integer ending in an SI prefix (eg. 1K) or auto
# Default value: auto
audioBitrate = auto

# The controller backend to use for detecting key presses
# Possible values: auto, debug, x11
# Default value: auto
controller = command

# The key name and key modifiers (as a set of flags) to press to save a video
# Default value: r
keyName = r
# Possible values: ctrl, shift, alt, super
# Default value: ctrl+super
keyMods = shift+super

# Where to save the output file
# Possible values: a strftime formatted file path
# Default value: ~/Videos/ReplaySorcery_%F_%H-%M-%S.mp4
outputFile = ~/Videos/ReplaySorcery/%F_%H-%M-%S.mp4

# A command to run when a video is successfully saved
# Possible values: a printf formatted command
# Default value: notify-send ReplaySorcery "Saved replay as %s"
outputCommand = notify-send ReplaySorcery "Saved replay as %s"

Logs:

Jun 26 17:19:31 moneymachine replay-sorcery[35886]: Failed to init DRM frames context: Invalid argument
Jun 26 17:19:31 moneymachine replay-sorcery[35886]: Failed to create KMS service device: Invalid argument
Jun 26 17:19:31 moneymachine replay-sorcery[35886]: [kmsgrab @ 0x558ad5680540] Using plane 60 to locate framebuffers.
Jun 26 17:19:31 moneymachine replay-sorcery[35886]: [kmsgrab @ 0x558ad5680540] Template framebuffer is 120: 1920x1080 format 30335241 modifier 200000020967b03 flags 2.
Jun 26 17:19:31 moneymachine replay-sorcery[35886]: [kmsgrab @ 0x558ad5680540] No handle set on framebuffer: maybe you need some additional capabilities?
Jun 26 17:19:31 moneymachine replay-sorcery[35886]: Unused option: framerate
Jun 26 17:19:31 moneymachine replay-sorcery[35886]: Failed to create KMS device: Invalid argument
Jun 26 17:19:31 moneymachine replay-sorcery[35886]: Function not implemented
Jun 26 17:19:31 moneymachine systemd[669]: replay-sorcery.service: Main process exited, code=exited, status=1/FAILURE
Jun 26 17:19:31 moneymachine systemd[669]: replay-sorcery.service: Failed with result 'exit-code'.
Jun 26 17:19:31 moneymachine systemd[669]: replay-sorcery.service: Scheduled restart job, restart counter is at 4.
Jun 26 17:19:31 moneymachine systemd[669]: Stopped ReplaySorcery: an open-source, instant-replay solution for Linux..
Jun 26 17:19:31 moneymachine systemd[669]: Started ReplaySorcery: an open-source, instant-replay solution for Linux..
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Reading config file '/usr/etc/replay-sorcery.conf'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'logLevel' to 'info'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'traceLevel' to 'error'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'recordSeconds' to '30'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoInput' to 'hwaccel'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoDevice' to 'auto'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoX' to '0'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoY' to '0'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoWidth' to '1920'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoHeight' to '1080'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoFramerate' to '30'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoEncoder' to 'vaapi_h264'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoProfile' to 'baseline'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoPreset' to 'fast'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoQuality' to '28'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoBitrate' to 'auto'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'videoGOP' to '30'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'scaleWidth' to 'auto'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'scaleHeight' to 'auto'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'audioInput' to 'auto'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'audioDevice' to 'auto'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'audioSamplerate' to '44100'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'audioEncoder' to 'auto'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'audioProfile' to 'low'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'audioBitrate' to 'auto'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'controller' to 'command'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'keyName' to 'r'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'keyMods' to 'shift+super'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'outputFile' to '~/Videos/ReplaySorcery/%F_%H-%M-%S.mp4'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Setting 'outputCommand' to 'notify-send ReplaySorcery "Saved replay as %s"'...
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Failed to open config file '/home/stecca/.config/replay-sorcery.conf': No such file or directory
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: ReplaySorcery  Copyright (C) 2020-2021  ReplaySorcery developers
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: This program comes with ABSOLUTELY NO WARRANTY.
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: This is free software, and you are welcome to redistribute it
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: under certain conditions; see COPYING for details.
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: FFmpeg version: n5.0.1
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: [AVHWFramesContext @ 0x55c6567c6940] [IMGUTILS @ 0x7ffeebecb650] Picture size 0x0 is invalid
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Failed to init DRM frames context: Invalid argument
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Failed to create KMS service device: Invalid argument
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: [kmsgrab @ 0x55c6567bf540] Using plane 60 to locate framebuffers.
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: [kmsgrab @ 0x55c6567bf540] Template framebuffer is 127: 1920x1080 format 30335241 modifier 200000020967b03 flags 2.
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: [kmsgrab @ 0x55c6567bf540] No handle set on framebuffer: maybe you need some additional capabilities?
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Unused option: framerate
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Failed to create KMS device: Invalid argument
Jun 26 17:19:31 moneymachine replay-sorcery[35887]: Function not implemented
Jun 26 17:19:31 moneymachine systemd[669]: replay-sorcery.service: Main process exited, code=exited, status=1/FAILURE
Jun 26 17:19:31 moneymachine systemd[669]: replay-sorcery.service: Failed with result 'exit-code'.
Jun 26 17:19:32 moneymachine systemd[669]: replay-sorcery.service: Scheduled restart job, restart counter is at 5.
Jun 26 17:19:32 moneymachine systemd[669]: Stopped ReplaySorcery: an open-source, instant-replay solution for Linux..
Jun 26 17:19:32 moneymachine systemd[669]: replay-sorcery.service: Start request repeated too quickly.
Jun 26 17:19:32 moneymachine systemd[669]: replay-sorcery.service: Failed with result 'exit-code'.
Jun 26 17:19:32 moneymachine systemd[669]: Failed to start ReplaySorcery: an open-source, instant-replay solution for Linux..
matanui159 commented 2 years ago

Can you also grab the logs of the replay-sorcery-kms service?

Katharta commented 2 years ago

Hello, I believe I'm running into the same thing. I am also running Arch using KDE with Wayland on an AMD 3700X & RX 5700 XT. Here is my replay-sorcery-kms log if it helps.

katharta@ragnarok[~]$ journalctl -fu replay-sorcery-kms
Aug 08 12:05:09 ragnarok replay-sorcery[278419]: Framerate = 60, Device = auto
Aug 08 12:05:09 ragnarok replay-sorcery[278419]: [kmsgrab @ 0x558f43326000] Using plane 65 to locate framebuffers.
Aug 08 12:05:09 ragnarok replay-sorcery[278419]: [kmsgrab @ 0x558f43326000] Template framebuffer is 119: 3440x1440 format 30335241 modifier 200000000801b02 flags 2.
Aug 08 12:05:09 ragnarok replay-sorcery[278419]: [kmsgrab @ 0x558f43326000] Framebuffer pixel format 30335241 is not a known supported format.
Aug 08 12:05:09 ragnarok replay-sorcery[278419]: Unused option: framerate
Aug 08 12:05:09 ragnarok replay-sorcery[278419]: Disconnected: Invalid argument
Steccah commented 2 years ago

I tried reinstalling everything but it still doesn't work

Steccah commented 2 years ago

if it could be of any help i use ffmpeg-amd-full

astroty commented 1 year ago

I can second this. I used to be able to run replay-sorcery properly up until 21-11-2022 but apparently I can't anymore. get same error with same logs pretty much

sylvesterroos commented 1 year ago

Same issue here

local config ``` # The minimum log-level to show # Possible values: trace, debug, verbose, info, warning, error, fatal, panic, quiet # Default value: info logLevel = info # The minimum log-level to add stacktraces to # Possible values: trace, debug, verbose, info, warning, error, fatal, panic, quiet # Default value: error traceLevel = error # The duration of the recording in seconds # Default value: 30 recordSeconds = 90 # The video input backend to use for video recording # Possible values: auto, hwaccel, x11, kms, kms_service # Default value: auto videoInput = kms_service # The name of the input video device # For kms and kms_service, see `replay-sorcery kms-devices` # Possible values: auto, or a device string # Default value: auto videoDevice = auto # The X, Y, width and height of recording rectangle # Default value: 0, 0 videoX = 0 videoY = 0 # Possible values: a positive integer or auto # Default value: auto, auto videoWidth = auto videoHeight = auto # The framerate of the recording # Default value: 30 videoFramerate = 60 # The video encoder backend to use for video recording # Possible values: auto, hevc, x264, openh264, x265, vaapi_h264, vaapi_hevc # Default value: auto videoEncoder = auto # The H.264 profile to use for video encoding # Possible values: baseline, main, high # Default value: baseline videoProfile = baseline # A high-level preset for video encoding performance # Possible values: fast, medium, slow # Default value: fast videoPreset = fast # The quality to use for video encoding, lower is better # Possible values: 1-51 or auto # Default value: 28 videoQuality = 28 # The bitrate to use for video encoding # Possible values: a positive integer ending in an SI prefix (eg. 1M) or auto # Default value: auto videoBitrate = auto # The number of frames between IDR frames # Default value: 30 videoGOP = 30 # The width and height to scale the video to # Possible values: a positive integer or auto # Default value: auto, auto scaleWidth = auto scaleHeight = auto # The audio input backend to use for audio recording # Possible values: none, auto, pulse # Default value: auto audioInput = auto # The name of the input audio device # For pulse, see `pactl list sources` # Possible values: auto, system, or a device string # Default value: auto audioDevice = auto # The samplerate to use for audio recording # Default value: 44100 audioSamplerate = 44100 # The audio encoder backend to use for audio recording # Possible values: auto, aac, fdk # Default value: auto audioEncoder = auto # The AAC profile to use for audio encoding # Possible values: low (LC), main, high (HE) # Default value: low audioProfile = low # The bitrate to use for audio encoding # Possible values: a positive integer ending in an SI prefix (eg. 1K) or auto # Default value: auto audioBitrate = auto # The controller backend to use for detecting key presses # Possible values: auto, debug, x11 # Default value: auto controller = command # The key name and key modifiers (as a set of flags) to press to save a video # Default value: r keyName = DONT_ACTIVATE # Possible values: ctrl, shift, alt, super # Default value: ctrl+super keyMods = alt+shift # Where to save the output file # Possible values: a strftime formatted file path # Default value: ~/Videos/ReplaySorcery_%F_%H-%M-%S.mp4 outputFile = ~/Videos/ReplaySorcery/%F_%H-%M-%S.mp4 # A command to run when a video is successfully saved # Possible values: a printf formatted command # Default value: notify-send ReplaySorcery "Saved replay as %s" outputCommand = notify-send ReplaySorcery "Saved replay as %s" ```

Where can I find the logs? 😅 My systemd log is pretty short:

$ journalctl --user -fu replay-sorcery.service

Journal file /var/log/journal/dc540a00cc1f472fb62d44441791e375/user-1000@e5aa7bd2826f491d8c36ca09ba1f0b05-0000000000000000-0000000000000000.journal corrupted, ignoring file.
Dec 29 13:32:47 icarus replay-sorcery[42539]: [AVHWFramesContext @ 0x557857c13b80] [IMGUTILS @ 0x7ffdb6b82da0] Picture size 0x0 is invalid
Dec 29 13:32:47 icarus replay-sorcery[42539]: Failed to init DRM frames context: Invalid argument
Dec 29 13:32:47 icarus replay-sorcery[42539]: Invalid argument
Dec 29 13:32:47 icarus systemd[3538]: replay-sorcery.service: Main process exited, code=exited, status=1/FAILURE
Dec 29 13:32:47 icarus systemd[3538]: replay-sorcery.service: Failed with result 'exit-code'.
Dec 29 13:32:47 icarus systemd[3538]: replay-sorcery.service: Scheduled restart job, restart counter is at 5.
Dec 29 13:32:47 icarus systemd[3538]: Stopped ReplaySorcery: an open-source, instant-replay solution for Linux..
Dec 29 13:32:47 icarus systemd[3538]: replay-sorcery.service: Start request repeated too quickly.
Dec 29 13:32:47 icarus systemd[3538]: replay-sorcery.service: Failed with result 'exit-code'.
Dec 29 13:32:47 icarus systemd[3538]: Failed to start ReplaySorcery: an open-source, instant-replay solution for Linux..
$ journalctl -fu replay-sorcery-kms.service

Journal file /var/log/journal/dc540a00cc1f472fb62d44441791e375/user-1000@e5aa7bd2826f491d8c36ca09ba1f0b05-0000000000000000-0000000000000000.journal corrupted, ignoring file.
Dec 29 13:32:47 icarus replay-sorcery[626]: [kmsgrab @ 0x55c30227e600] Template framebuffer is 111: 1920x1080 format 30335241 modifier 200000004801a01 flags 2.
Dec 29 13:32:47 icarus replay-sorcery[626]: [kmsgrab @ 0x55c30227e600] Framebuffer pixel format 30335241 is not a known supported format.
Dec 29 13:32:47 icarus replay-sorcery[626]: Unused option: framerate
Dec 29 13:32:47 icarus replay-sorcery[626]: Disconnected: Invalid argument
Dec 29 13:32:47 icarus replay-sorcery[626]: Framerate = 60, Device = auto
Dec 29 13:32:47 icarus replay-sorcery[626]: [kmsgrab @ 0x55c30227f600] Using plane 52 to locate framebuffers.
Dec 29 13:32:47 icarus replay-sorcery[626]: [kmsgrab @ 0x55c30227f600] Template framebuffer is 105: 1920x1080 format 30335241 modifier 200000004801a01 flags 2.
Dec 29 13:32:47 icarus replay-sorcery[626]: [kmsgrab @ 0x55c30227f600] Framebuffer pixel format 30335241 is not a known supported format.
Dec 29 13:32:47 icarus replay-sorcery[626]: Unused option: framerate
Dec 29 13:32:47 icarus replay-sorcery[626]: Disconnected: Invalid argument
awsms commented 1 year ago

since this is not going to be fixed, anyone knows a software alternative?

kode54 commented 1 year ago

Try kms_service in combination with the replay-sorcery-kms.service daemon. Set the video device string to:

card#:#

Where the first number is the DRM device number from /dev/dri/card#, and the second number is the Object ID of the Plane you want to capture. With auto it will pick the first card and the first plane, which may not always be correct.

If replay-sorcery kms-devices doesn't work for you, try the drm_info software package, which may have distribution packaging for you, and look through its output for the correct Plane you wish to capture, referred to by its Object ID number. This number may not be consistent across installs or even reboots, but I've had some luck with it remaining the same with consistent hardware and kernel installs.

toasterofbread commented 12 months ago

For those with issues running replay-sorcery kms-devices:

It fails for me with the error Failed to get DRM framebuffer 120: Invalid argument when running it from within my DE (Hyprland), but works perfectly fine from a fresh TTY. I set videoDevice using the output like @kode54 suggested and everything worked perfectly from there.

Based on lines like Failed to create KMS device: Invalid argument in the original logs above, I'm guessing whatever causes this to fail is also what's causing issues with replay-sorcery itself when not explicitly setting the videoDevice.

toasterofbread commented 9 months ago

Several months later, and the solution I mentioned no longer works for me (presumably due to driver changes).

Now, replay-sorcery kms-devices always prints this and exits with no error or useful output.

Real user ID: 1000
Effective user ID: 1000