russelltg / wl-screenrec

High performance wlroots screen recording, featuring hardware encoding
Apache License 2.0
305 stars 9 forks source link

Failed to screencopy #53

Closed herrwusel closed 8 months ago

herrwusel commented 8 months ago

With version 0.1.2 and wl-screenrec --codec vp9 -vvv --output DP-2 I get:

$ wl-screenrec --codec vp9 -vvv --output DP-2
Using output DP-2
[file @ 0x562e4f50e540] Setting default whitelist 'file,crypto,data'
Opening libva device from DRM device /dev/dri/renderD128
[AVHWDeviceContext @ 0x562e4f512fc0] libva: VA-API version 1.20.0
[AVHWDeviceContext @ 0x562e4f512fc0] libva: User environment variable requested driver 'iHD'
[AVHWDeviceContext @ 0x562e4f512fc0] libva: Trying to open /usr/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x562e4f512fc0] libva: Found init function __vaDriverInit_1_20
[AVHWDeviceContext @ 0x562e4f512fc0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x562e4f512fc0] Initialised VAAPI connection: version 1.20
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x42475241 -> argb.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x52474241 -> abgr.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x42475258 -> 0rgb.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x52474258 -> 0bgr.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30335241 -> unknown.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30334241 -> unknown.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30335258 -> x2rgb10le.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30334258 -> unknown.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x36314752 -> unknown.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x56555941 -> unknown.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x56555958 -> vuyx.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30303859 -> gray.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x3132564e -> unknown.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x50313134 -> yuv411p.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x56323234 -> yuv440p.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x50343434 -> yuv444p.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x33434d49 -> unknown.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30313259 -> y210le.
[AVHWDeviceContext @ 0x562e4f512fc0] Format 0x30313459 -> xv30le.
[AVHWDeviceContext @ 0x562e4f512fc0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 24.1.1 ().
[AVHWDeviceContext @ 0x562e4f512fc0] Driver not found in known nonstandard list, using standard behaviour.
[AVHWFramesContext @ 0x562e4f542700] Created surface 0.
[AVHWFramesContext @ 0x562e4f542700] Direct mapping disabled: derived image format 58524742 does not match expected format 42475258.
[AVHWFramesContext @ 0x562e4f542700] Created surface 0x1.
[AVHWFramesContext @ 0x562e4f542700] Created surface 0x2.
[AVHWFramesContext @ 0x562e4f542700] Created surface 0x3.
[AVHWFramesContext @ 0x562e4f542700] Created surface 0x4.
detected 8 logical cores
[in @ 0x562e4f56de00] Setting 'video_size' to value '2840x2160'
[in @ 0x562e4f56de00] Setting 'pix_fmt' to value '44'
[in @ 0x562e4f56de00] Setting 'time_base' to value '1/1000000000'
[in @ 0x562e4f56de00] w:2840 h:2160 pixfmt:vaapi tb:1/1000000000 fr:0/1 sar:0/1
[AVFilterGraph @ 0x562e4f56c600] Setting 'out_w' to value '3840'
[AVFilterGraph @ 0x562e4f56c600] Setting 'out_h' to value '2160'
[AVFilterGraph @ 0x562e4f56c600] Setting 'x' to value '0'
[AVFilterGraph @ 0x562e4f56c600] Setting 'y' to value '0'
[AVFilterGraph @ 0x562e4f56c600] Setting 'exact' to value '1'
[AVFilterGraph @ 0x562e4f56c600] Setting 'format' to value 'nv12'
[AVFilterGraph @ 0x562e4f56c600] Setting 'w' to value '3840'
[AVFilterGraph @ 0x562e4f56c600] Setting 'h' to value '2160'
[AVFilterGraph @ 0x562e4f56c600] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[Parsed_crop_0 @ 0x562e4f56e3c0] w:3840 h:2160 sar:0/1 -> w:3840 h:2160 sar:0/1
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0x5.
[AVHWFramesContext @ 0x562e4f56ff40] Direct mapping possible.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0x6.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0x7.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0x8.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0x9.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0xa.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0xb.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0xc.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0xd.
[AVHWFramesContext @ 0x562e4f56ff40] Created surface 0xe.
[AVHWFramesContext @ 0x562e4f56f700] Created surface 0xf.
[AVHWFramesContext @ 0x562e4f56f700] Direct mapping possible.
[AVHWFramesContext @ 0x562e4f56f700] Created surface 0x10.
[AVHWFramesContext @ 0x562e4f56f700] Created surface 0x11.
[AVHWFramesContext @ 0x562e4f56f700] Created surface 0x12.
[AVHWFramesContext @ 0x562e4f56f700] Created surface 0x13.
+----------+
|    in    |default--[3840x2160 0:1 vaapi]--Parsed_crop_0:default
| (buffer) |
+----------+

                                                            +--------------+
Parsed_scale_vaapi_1:default--[3840x2160 0:1 vaapi]--default|     out      |
                                                            | (buffersink) |
                                                            +--------------+

                                          +---------------+
in:default--[3840x2160 0:1 vaapi]--default| Parsed_crop_0 |default--[3840x2160 0:1 vaapi]--Parsed_scale_vaapi_1:default
                                          |    (crop)     |
                                          +---------------+

                                                     +----------------------+
Parsed_crop_0:default--[3840x2160 0:1 vaapi]--default| Parsed_scale_vaapi_1 |default--[3840x2160 0:1 vaapi]--out:default
                                                     |    (scale_vaapi)     |
                                                     +----------------------+

[vp9_vaapi @ 0x562e4f60af80] Input surface format is nv12.
[vp9_vaapi @ 0x562e4f60af80] Using VAAPI profile VAProfileVP9Profile0 (19).
[vp9_vaapi @ 0x562e4f60af80] Using VAAPI entrypoint VAEntrypointEncSliceLP (8).
[vp9_vaapi @ 0x562e4f60af80] Using VAAPI render target format YUV420 (0x1).
[vp9_vaapi @ 0x562e4f60af80] Driver supports RC modes CQP, CBR, VBR.
[vp9_vaapi @ 0x562e4f60af80] Driver does not support AVBR RC mode.
[vp9_vaapi @ 0x562e4f60af80] RC mode: VBR.
[vp9_vaapi @ 0x562e4f60af80] RC target: 50% of 80000000 bps over 500 ms.
[vp9_vaapi @ 0x562e4f60af80] RC buffer: 40000000 bits, initial fullness 30000000 bits.
[vp9_vaapi @ 0x562e4f60af80] RC framerate: 60/1 (60.00 fps).
[vp9_vaapi @ 0x562e4f60af80] Driver does not report any additional prediction constraints.
[vp9_vaapi @ 0x562e4f60af80] Using intra and P-frames (supported references: 3 / 0).
[vp9_vaapi @ 0x562e4f60af80] All wanted packed headers available (wanted 0, found 0x10).
[vp9_vaapi @ 0x562e4f60af80] Using nv12 as format of reconstructed frames.
[AVHWFramesContext @ 0x562e4f60bb00] Created surface 0x14.
[AVHWFramesContext @ 0x562e4f60bb00] Direct mapping possible.
Output #0, mp4, to 'screenrecord.mp4':
  Metadata:
    encoder         : Lavf60.17.100
  Stream #0:0, 0, 1/90000: Video: vp9 (Profile 0), 1 reference frame (vp09 / 0x39307076), vaapi, 3840x2160 (0x0), 0/1, q=2-31, 40000 kb/s, 90k tbn
Failed to screencopy!
[AVIOContext @ 0x562e4f51f380] Statistics: 262 bytes written, 2 seeks, 3 writeouts

Similarly, with wf-recorder I can record the screen:

$ wf-recorder -f test-vaapi.mp4 -c vp9_vaapi -d /dev/dri/renderD128
Output file "test-vaapi.mp4" exists. Overwrite? Y/n: 
using VA-API, trying to enable DMA-BUF capture...
enabled DMA-BUF capture, device /dev/dri/renderD128
Please select an output from the list to capture (enter output no.):
1. Name: eDP-1 Description: BOE 0x0821 (eDP-1)
2. Name: DP-2 Description: LG Electronics LG ULTRAFINE 308MASX9J302 (DP-2 via HDMI)
Enter output no.:2
selected region 0,0 0x0
Using video filter: scale_vaapi=format=nv12:out_range=full
[vp9_vaapi @ 0x7fb780001ec0] No quality level set; using default (100).
Output #0, mp4, to 'test-vaapi.mp4':
  Stream #0:0: Video: vp9 (Profile 0), vaapi(pc), 3843x2162 [SAR 1:1 DAR 3843:2162], q=2-31
$ vainfo 
Trying display: wayland
vainfo: VA-API version: 1.20 (libva 2.20.1)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.1.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSlice
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
herrwusel commented 8 months ago

This is fixed now by upgrading packages. I'm not entirely sure which package exactly was at fault, but I noticed that vulkan-intel got upgraded.