ffmpeg hevc_vaapi: Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0'

on Linux i am trying to encode file to H€VC using hardware acceleration. Successful attempt is:

ffmpeg -v verbose -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i '/path/file.mkv' -vcodec libx265 -crf 28 '/path/file.mp4'

but it is slow like 30fps, "ffmpeg -codecs|grep 265" shows: (encoders: libx265 nvenc_hevc hevc_amf hevc_nvenc hevc_qsv hevc_v4l2m2m hevc_vaapi )

so i have tried hevc_vaapi:

ffmpeg -v verbose -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i '/path/file.mkv' -vcodec hevc_vaapi -crf 28 '/path/file.mp4'

but it fails:

Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
[AVIOContext @ 0x55d831121340] Statistics: 0 seeks, 0 writeouts
[aac @ 0x55d831142a00] Qavg: 30414.529
[aac @ 0x55d831142a00] 2 frames left in the queue on closing
[AVIOContext @ 0x55d831109ec0] Statistics: 65536 bytes read, 0 seeks
Conversion failed!

$ ffmpeg -hwaccels shows "

Hardware acceleration methods:
vdpau
cuda
vaapi
qsv
drm

"

$ vaapi shows this (seems like va-api is there, mesa driver)

$ ls /dev/dri/*

/dev/dri/card0 /dev/dri/renderD128

/dev/dri/by-path:

pci-0000:0a:00.0-card pci-0000:0a:00.0-render

What do you think about this error or how would you proceed to discover which ffmpeg parameters to use for HW H€VC accelerated?

Update: i think that the "-hwaccel vaapi" may be redundant parameter


I think that it requires proper encoding parameters like -vf 'format=nv12,hwupload' and following one-liner may work if you have VAAPI driver:

echo "Input file:" && read -r i && echo "Quality: 25=identic, 30=a bit worse but small file size, or other numbers:" && read -r q && ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -vf 'format=nv12,hwupload' -c:v hevc_vaapi -f mp4 -rc_mode 1 -qp "$q" "$i.hevc.mp4"