Skip to content

Not working with ffmpeg #5

@strongtz

Description

@strongtz

First of all, thanks a lot for your great work!
I tried this on rk3568 with mainline kernel (v6.2.10). vainfo works fine, but decoding h264 with ffmpeg doesn't seem to work:

$ LIBVA_DRIVERS_PATH=~/git/libva-v4l2/build/src LIBVA_DRIVER_NAME=v4l2 ffmpeg -v debug -hwaccel vaapi -i ~/Big_Buck_Bunny_1080_10s_30MB.mp4 -f null -

......

[vost#0:0/wrapped_avframe @ 0xaaaae4252b00] Created video stream from input stream 0:0
[AVHWDeviceContext @ 0xaaaae43a0ec0] Trying to use DRM render node for device 0.
[AVHWDeviceContext @ 0xaaaae43a0ec0] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0xaaaae43a0ec0] libva: User environment variable requested driver 'v4l2'
[AVHWDeviceContext @ 0xaaaae43a0ec0] libva: Trying to open /home/strongtz/git/libva-v4l2/build/src/v4l2_drv_video.so
[AVHWDeviceContext @ 0xaaaae43a0ec0] libva: Found init function __vaDriverInit_1_22
[AVHWDeviceContext @ 0xaaaae43a0ec0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0xaaaae43a0ec0] Initialised VAAPI connection: version 1.22
[AVHWDeviceContext @ 0xaaaae43a0ec0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0xaaaae43a0ec0] VAAPI driver: v4l2.
[AVHWDeviceContext @ 0xaaaae43a0ec0] Driver not found in known nonstandard list, using standard behaviour.

......

[h264 @ 0xaaaae424ddc0] Format vaapi chosen by get_format().
[h264 @ 0xaaaae424ddc0] Format vaapi requires hwaccel h264_vaapi initialisation.
[h264 @ 0xaaaae424ddc0] Considering format 0x3231564e -> nv12.
[h264 @ 0xaaaae424ddc0] Picked nv12 (0x3231564e) as best match for yuv420p.
[AVHWFramesContext @ 0xffff70172d10] Created surface 0.
[AVHWDeviceContext @ 0xaaaae43a0ec0] libva: deriveImage 2
[AVHWFramesContext @ 0xffff70172d10] Direct mapping disabled: deriving image does not work: 1 (operation failed).
[AVHWDeviceContext @ 0xaaaae43a0ec0] libva: Failed to create context: No surfaces to be created
[h264 @ 0xaaaae424ddc0] Failed to create decode context: 1 (operation failed).
[h264 @ 0xaaaae424ddc0] Failed to destroy decode context 0: 5 (invalid VAContextID).
[h264 @ 0xaaaae424ddc0] Failed setup for format vaapi: hwaccel initialisation returned error.
[h264 @ 0xaaaae424ddc0] Format vaapi not usable, retrying get_format() without it.
[h264 @ 0xaaaae424ddc0] Format yuv420p chosen by get_format().
[h264 @ 0xaaaae424ddc0] Reinit context to 1920x1088, pix_fmt: yuv420p

I added some debug prints, and the problem seems to be here:
https://github.com/mxsrc/libva-v4l2/blob/master/src/image.cc#L156
https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/hwcontext_vaapi.c#L672

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions