matanui159 / ReplaySorcery

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

Issue with FFmpeg #82

Closed parkerlreed closed 3 years ago

parkerlreed commented 3 years ago

Describe the bug

Videos fails to save with error. hwaccel and vaapi enabled.

Dec 23 11:23:17 stealth replay-sorcery[19388]: Failed to write packet: Invalid argument
Dec 23 11:23:17 stealth replay-sorcery[19388]: Failed to output video: Invalid argument

Desktop:

Configuration:

replay-sorcery.txt

Logs:

replay-sorcery.log

parkerlreed commented 3 years ago

Tried with the audio encoder set to aac instead of auto but ends up failing to save the video as well

Dec 23 11:31:37 stealth replay-sorcery[20028]: ReplaySorcery  Copyright (C) 2020  ReplaySorcery developers
Dec 23 11:31:37 stealth replay-sorcery[20028]: This program comes with ABSOLUTELY NO WARRANTY.
Dec 23 11:31:37 stealth replay-sorcery[20028]: This is free software, and you are welcome to redistribute it
Dec 23 11:31:37 stealth replay-sorcery[20028]: under certain conditions; see COPYING for details.
Dec 23 11:31:37 stealth replay-sorcery[20028]: FFmpeg version: n4.3.1
Dec 23 11:31:37 stealth replay-sorcery[20028]: [kmsgrab @ 0x558f381dedc0] Using plane 31 to locate framebuffers.
Dec 23 11:31:37 stealth replay-sorcery[20028]: [kmsgrab @ 0x558f381dedc0] Template framebuffer is 97: 2560x1440 32bpp 24b depth.
Dec 23 11:31:37 stealth replay-sorcery[20028]: Created KMS device
Dec 23 11:31:37 stealth replay-sorcery[20028]: [h264_vaapi @ 0x558f381e1c40] Filter graph: hwmap=derive_device=vaapi,crop=2560:1440:0:0,scale_vaapi=2560:1440:nv12
Dec 23 11:31:37 stealth replay-sorcery[20028]: [h264_vaapi @ 0x558f381e1c40] H.264 baseline profile is not supported, using constrained baseline profile instead.
Dec 23 11:31:37 stealth replay-sorcery[20028]: PulseAudio server: pulseaudio 14.0
Dec 23 11:31:37 stealth replay-sorcery[20028]: Connecting to Pulse Audio device: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor...
Dec 23 11:31:37 stealth replay-sorcery[20028]: Created PulseAudio device
Dec 23 11:31:37 stealth replay-sorcery[20028]: X11 version: 11.0
Dec 23 11:31:37 stealth replay-sorcery[20028]: X11 vendor: The X.Org Foundation v12010000
Dec 23 11:31:37 stealth replay-sorcery[20028]: Created X11 controller
Dec 23 11:32:04 stealth replay-sorcery[20028]: Saving video to '/home/parker/Videos/ReplaySorcery_2020-12-23_11-32-04.mp4'...
Dec 23 11:32:04 stealth replay-sorcery[20028]: [aac @ 0x558f385c5340] Filter graph: aformat=fltp
Dec 23 11:32:04 stealth replay-sorcery[20028]: [aac @ 0x558f385c5340] Qavg: 65507.398
Dec 23 11:32:04 stealth replay-sorcery[20028]: [mp4 @ 0x558f385c4d00] pts (14645) < dts (29290) in stream 0
Dec 23 11:32:04 stealth replay-sorcery[20028]: Failed to write packet: Invalid argument
Dec 23 11:32:04 stealth replay-sorcery[20028]: Failed to output video: Invalid argument
matanui159 commented 3 years ago

I so far haven't been able to track down the root cause of this and I have no leads as to why it might be happening. Can you set logLevel in replay-sorcery.conf to values like verbose, debug or trace to see if it provides any more info while saving?

parkerlreed commented 3 years ago

Can do. Will let you know when I can get back to that computer.

parkerlreed commented 3 years ago

Verbose

Dec 29 13:25:34 stealth replay-sorcery[17653]: [h264_vaapi @ 0x55ec7a02dc40] RC framerate: 60/1 (60.00 fps).
Dec 29 13:25:34 stealth replay-sorcery[17653]: [h264_vaapi @ 0x55ec7a02dc40] Using intra, P- and B-frames (supported references: 4 / 1).
Dec 29 13:25:34 stealth replay-sorcery[17653]: [h264_vaapi @ 0x55ec7a02dc40] All wanted packed headers available (wanted 0xd, found 0x1f).
Dec 29 13:25:34 stealth replay-sorcery[17653]: [h264_vaapi @ 0x55ec7a02dc40] Using level 5.1.
Dec 29 13:25:34 stealth replay-sorcery[17653]: PulseAudio server: pulseaudio 14.0
Dec 29 13:25:34 stealth replay-sorcery[17653]: Connecting to Pulse Audio device: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor...
Dec 29 13:25:34 stealth replay-sorcery[17653]: Created PulseAudio device
Dec 29 13:25:34 stealth replay-sorcery[17653]: X11 version: 11.0
Dec 29 13:25:34 stealth replay-sorcery[17653]: X11 vendor: The X.Org Foundation v12010000
Dec 29 13:25:34 stealth replay-sorcery[17653]: Created X11 controller
Dec 29 13:25:42 stealth replay-sorcery[17653]: Saving video to '/home/parker/Videos/ReplaySorcery_2020-12-29_13-25-42.mp4'...
Dec 29 13:25:42 stealth replay-sorcery[17653]: [aac @ 0x55ec7a1dbf00] Filter graph: aformat=fltp
Dec 29 13:25:42 stealth replay-sorcery[17653]: [abuffer @ 0x55ec7a1ea4c0] tb:1/44100 samplefmt:flt samplerate:44100 chlayout:0x4
Dec 29 13:25:42 stealth replay-sorcery[17653]: [Parsed_aformat_0 @ 0x55ec7a1b6280] auto-inserting filter 'auto_resampler_0' between the filter '(null)' and the filter 'Parsed_aformat_0'
Dec 29 13:25:42 stealth replay-sorcery[17653]: [auto_resampler_0 @ 0x55ec7a2b7f40] ch:1 chl:mono fmt:flt r:44100Hz -> ch:1 chl:mono fmt:fltp r:44100Hz
Dec 29 13:25:42 stealth replay-sorcery[17653]: [aac @ 0x55ec7a1dbf00] Qavg: 65433.066
Dec 29 13:25:42 stealth replay-sorcery[17653]: [mp4 @ 0x55ec7a1b5c40] pts (14625) < dts (29250) in stream 0
Dec 29 13:25:42 stealth replay-sorcery[17653]: Failed to write packet: Invalid argument
Dec 29 13:25:42 stealth replay-sorcery[17653]: [AVIOContext @ 0x55ec7a170e00] Statistics: 0 seeks, 2 writeouts
Dec 29 13:25:42 stealth replay-sorcery[17653]: Failed to output video: Invalid argument

Debug prints a ton of VAAPI information but I don't see anything relating to the video saving.

matanui159 commented 3 years ago

Can you try latest master to see if it works? I have a potential fix

matanui159 commented 3 years ago

Did latest master end up fixing the issue?

parkerlreed commented 3 years ago

Sorry, been tied up a bit. Just about to test.

parkerlreed commented 3 years ago

Working great! :+1:

parkerlreed commented 3 years ago

Quick question. KMS auto picks the first device. I'm trying to set it to the second but no matter how I format it, replay sourcery doesn't start. Is the videoDevice setting expecting another syntax?

[parker@stealth Sonic CD]$ replay-sorcery kms-devices
card0:31 (2560x1440x24)
card1:48 (1920x1080x24)

I've tried both

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

and

# The name of the input video device
# For kms, see `replay-sorcery kms-devices`
# Possible values: auto, or a device string
# Default value: auto
videoDevice = 'card1:48'
parkerlreed commented 3 years ago

Seems to be another issue. I had the format right. Opening it separately.