ammen99 / wf-recorder

MIT License
858 stars 63 forks source link

NVENC encoders error out #205

Open raffaem opened 1 year ago

raffaem commented 1 year ago
❯ wf-recorder --codec h264_nvenc -f recording.mkv
selected region 0,0 0x0
Using video filter: null
Output #0, matroska, to 'recording.mkv':
  Stream #0:0: Video: h264 (Main), bgr0(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s
[matroska @ 0x7fbf3c000dc0] pts (20) < dts (81) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (81) < dts (250) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (250) < dts (490) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (534) < dts (624) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (624) < dts (645) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (645) < dts (664) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (678) < dts (684) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (684) < dts (691) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (691) < dts (698) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (705) < dts (712) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (712) < dts (719) in stream 0
[matroska @ 0x7fbf3c000dc0] pts (719) < dts (726) in stream 0

I can use such encoder with ffmpeg:

ffmpeg -f v4l2 -i /dev/video0 -c:v h264_nvenc out.mkv

Arch Linux, GPU: NVIDIA GeForce RTX 3050 Mobile, Driver Version: 525.60.11 (nvidia-open-dkms), CUDA Version: 12.0

oliob commented 10 months ago

Hi, had the same issue, but fixed by using --bframes (or -b): wf-recorder --codec h264_nvenc -b -f recording.mp4

Rabcor commented 5 months ago

Interesting, I do not have this issue, and I am using quite an elaborate command too.

$ wf-recorder -a easyeffects_sink -C aac -r 60 -c hevc_nvenc -p tier=high -p spatial-aq=1 -p multipass=fullres -p rc=vbr -p cq=24 -p qmin=24 -p qmax=24 -p profile:v=main10 -p preset:v=p7 -x yuv444p -F hue=h=-3:s=0.98, eq=gamma=0.98:contrast=0.99 -f ~/Videos/190424-215004.mp4
selected region 0,0 0x0
Setting codec option: cq=24
Setting codec option: multipass=fullres
Setting codec option: preset:v=p7
Setting codec option: profile:v=main10
Setting codec option: qmax=24
Setting codec option: qmin=24
Setting codec option: rc=vbr
Setting codec option: spatial-aq=1
Setting codec option: tier=high
Framerate: 60
Using video filter: hue=h=-3:s=0.98, eq=gamma=0.98:contrast=0.99,fps=60
Setting codec option: cq=24
Setting codec option: multipass=fullres
Setting codec option: preset:v=p7
Setting codec option: profile:v=main10
Setting codec option: qmax=24
Setting codec option: qmin=24
Setting codec option: rc=vbr
Setting codec option: spatial-aq=1
Setting codec option: tier=high
Choosing sample format fltp for audio codec aac
Output #0, mp4, to '~/Videos/190424-215004.mp4':
  Stream #0:0: Video: hevc (Rext), yuv444p(pc), 2560x1440 [SAR 1:1 DAR 16:9], q=2-31
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
Using PulseAudio device: default
^C[aac @ 0x71c27163eb80] Qavg: 392.037

I also tried with h264 instead of hevc, same result.

I am on endeavouros, instead of nvidia-open-dkms I am on nvidia-dkms 550.67-1, so that might be the difference.

But I can see this issue is quite old, so maybe it has just been fixed by now?

paul-maxime commented 1 week ago

To use nvenc, -r seems to be required:

wf-recorder --codec h264_nvenc -r 60 -f recording.mkv