11-15-2020, 05:18 PM
So it's a been a while, and I somehow lost my original account, but I've made progress!
I read through all the mainline hwaccel and pbp-tools posts and got some really good info. I ran the pbp-tool scripts for libva, libva-v4l2-request, and ffmpeg. However, the ffmpeg script seems to fail. Despite that, I built the 4.3 version of the kwiboo repo. After pointing VAAPI at the rkvdec device (by running export "LIBVA_DRIVER_NAME=v4l2_request" and "export LIBVA_V4L2_REQUEST_VIDEO_PATH=/dev/video1", vainfo says everything looks good:
(I know the above listing changes with every boot)
So I attempted a test decode of big buck bunny from a local mp4 file
Now, moonlight hits a very similar message ("Failed to sync surface (invalid VAContextID)."):
Can anyone tell me if i still need to update the kernel with pbp-tools? I'm on the latest manjaro release (5.9.6) and assumed all the acceleration patches have been mainlined by now.
If it's not the kernel, is there a version of ffmpeg I should be using?
I read through all the mainline hwaccel and pbp-tools posts and got some really good info. I ran the pbp-tool scripts for libva, libva-v4l2-request, and ffmpeg. However, the ffmpeg script seems to fail. Despite that, I built the 4.3 version of the kwiboo repo. After pointing VAAPI at the rkvdec device (by running export "LIBVA_DRIVER_NAME=v4l2_request" and "export LIBVA_V4L2_REQUEST_VIDEO_PATH=/dev/video1", vainfo says everything looks good:
Code:
v4l2-ctl --list-devices
rockchip,rk3399-vpu-enc (platform: hantro-vpu):
/dev/video0
/dev/video2
/dev/media1
rockchip-rga (platform:rga):
/dev/video3
rkvdec (platform:rkvdec):
/dev/video1
/dev/media0
USB Camera: USB Camera (usb-fe3c0000.usb-1.2):
/dev/video4
/dev/video5
/dev/media2
Code:
vainfo: VA-API version: 1.9 (libva 2.8.0)
vainfo: Driver version: v4l2-request
vainfo: Supported profile and entrypoints
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264MultiviewHigh : VAEntrypointVLD
VAProfileH264StereoHigh : VAEntrypointVLD
So I attempted a test decode of big buck bunny from a local mp4 file
Code:
ffmpeg -hwaccel vaapi -vaapi_device /dev/video1 -i ./Big_Buck_Bunny_1080_10s_1MB.mp4 -an output.mp4 -loglevel verbose
[AVHWDeviceContext @ 0xaaab0c820ad0] libva: VA-API version 1.9.0
[AVHWDeviceContext @ 0xaaab0c820ad0] libva: User environment variable requested driver 'v4l2_request'
[AVHWDeviceContext @ 0xaaab0c820ad0] libva: Trying to open /usr/lib/dri/v4l2_request_drv_video.so
[AVHWDeviceContext @ 0xaaab0c820ad0] libva: Found init function __vaDriverInit_1_8
[AVHWDeviceContext @ 0xaaab0c820ad0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0xaaab0c820ad0] Initialised VAAPI connection: version 1.9
[AVHWDeviceContext @ 0xaaab0c820ad0] VAAPI driver: v4l2-request.
[AVHWDeviceContext @ 0xaaab0c820ad0] Driver not found in known nonstandard list, using standard behaviour.
[h264 @ 0xaaab0c839900] Reinit context to 1920x1088, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './Big_Buck_Bunny_1080_10s_1MB.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : Big Buck Bunny, Sunflower version
artist : Blender Foundation 2008, Janus Bager Kristensen 2013
composer : Sacha Goedegebure
encoder : Lavf57.63.100
comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
genre : Animation
Duration: 00:00:10.00, start: 0.000000, bitrate: 815 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:
9], 812 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[h264 @ 0xaaab0c8c3b60] Reinit context to 1920x1088, pix_fmt: vaapi_vld
[AVHWFramesContext @ 0xffffa005a8a0] Failed to sync surface 0x400001a: 5 (invalid VAContextID).
[h264 @ 0xaaab0c83a730] Failed to transfer data to output frame: -5.
Error while processing the decoded data for stream #0:0
[AVIOContext @ 0xaaab0c806d50] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0xaaab0c807320] Statistics: 111917 bytes read, 0 seeks
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000019: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000015: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000014: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000018: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x400001a: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000016: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000017: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000012: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000013: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000011: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000010: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x400000f: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x400000e: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x400000d: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x400000c: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x400000b: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x400000a: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000009: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000008: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000007: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000006: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000005: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000004: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000003: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000002: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000001: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0xffffa005a8a0] Failed to destroy surface 0x4000000: 6 (invalid VASurfaceID).
Now, moonlight hits a very similar message ("Failed to sync surface (invalid VAContextID)."):
Code:
00:00:00 - SDL Info (0): Compiled with SDL 2.0.12
00:00:00 - SDL Info (0): Running with SDL 2.0.12
00:00:00 - Qt Info: Found "gamecontrollerdb.txt" at ":/data/gamecontrollerdb.txt"
00:00:00 - SDL Info (0): Loaded 113 new gamepad mappings
00:00:00 - SDL Info (0): V-sync enabled
00:00:00 - SDL Info (0): Initialized VAAPI 1.9
00:00:00 - SDL Info (0): Driver: v4l2-request
00:00:00 - FFmpeg: [AVHWDeviceContext @ 0xaaaad6d9eea0] Format 0x3231564e -> nv12.
00:00:00 - FFmpeg: [AVHWDeviceContext @ 0xaaaad6d9eea0] VAAPI driver: v4l2-request.
00:00:00 - FFmpeg: [AVHWDeviceContext @ 0xaaaad6d9eea0] Driver not found in known nonstandard list, using standard behaviour.
00:00:00 - SDL Info (0): VAAPI driver supports exporting DRM PRIME surface handles
00:00:00 - SDL Info (0): Using VAAPI accelerated renderer on x11
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] nal_unit_type: 7(SPS), nal_ref_idc: 3
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] nal_unit_type: 8(PPS), nal_ref_idc: 3
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] nal_unit_type: 5(IDR), nal_ref_idc: 3
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] nal_unit_type: 5(IDR), nal_ref_idc: 3
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] nal_unit_type: 5(IDR), nal_ref_idc: 3
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] nal_unit_type: 5(IDR), nal_ref_idc: 3
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] Format vaapi_vld chosen by get_format().
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] Format vaapi_vld requires hwaccel initialisation.
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] Considering format 0x3231564e -> nv12.
00:00:00 - FFmpeg: [h264 @ 0xaaaad6eb0250] Picked nv12 (0x3231564e) as best match for yuv420p.
00:00:00 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000000.
00:00:00 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Direct mapping possible.
00:00:00 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000001.
00:00:00 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000002.
00:00:00 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000003.
00:00:00 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000004.
00:00:00 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000005.
00:00:00 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000006.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000007.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000008.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000009.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x400000a.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x400000b.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x400000c.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x400000d.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x400000e.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x400000f.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000010.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000011.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000012.
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Created surface 0x4000013.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Considering format 0x3231564e -> nv12.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Picked nv12 (0x3231564e) as best match for yuv420p.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Decode context initialised: 0x1000000/0x2000000.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Reinit context to 1280x720, pix_fmt: vaapi_vld
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Param buffer (type 0, 672 bytes) is 0x8000000.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Param buffer (type 1, 240 bytes) is 0x8000001.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Slice 0 param buffer (3128 bytes) is 0x8000002.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Slice 0 data buffer (75 bytes) is 0x8000003.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Slice 1 param buffer (3128 bytes) is 0x8000004.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Slice 1 data buffer (80 bytes) is 0x8000005.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Slice 2 param buffer (3128 bytes) is 0x8000006.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Slice 2 data buffer (85 bytes) is 0x8000007.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Slice 3 param buffer (3128 bytes) is 0x8000008.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Slice 3 data buffer (97 bytes) is 0x8000009.
00:00:01 - FFmpeg: [h264 @ 0xaaaad6eb0250] Decode to surface 0x4000013.
00:00:01 - SDL Info (0): FFmpeg-based video decoder chosen
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000013: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000012: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000011: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000010: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x400000f: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x400000e: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x400000d: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x400000c: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x400000b: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x400000a: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000009: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000008: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000007: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000006: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000005: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000004: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000003: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000002: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000001: 6 (invalid VASurfaceID).
00:00:01 - FFmpeg: [AVHWFramesContext @ 0xaaaad6e9d4a0] Failed to destroy surface 0x4000000: 6 (invalid VASurfaceID).
Can anyone tell me if i still need to update the kernel with pbp-tools? I'm on the latest manjaro release (5.9.6) and assumed all the acceleration patches have been mainlined by now.
If it's not the kernel, is there a version of ffmpeg I should be using?