Here is how I made it work. I have also Debian 10 installed on ASRock J4205. tvheadend: version 4.3-1923~gaaca05cc1
1. First absolutely check if in your system exists /dev/dri/renderD128. Then inspect its properties, in particular which group it belongs to, using a command:
$ ls -l /dev/dri/renderD128
crw-rw----+ 1 root render 226, 128 mar 28 14:19 /dev/dri/renderD128
All tutorials I read claims that is should belong to "video" group, but in my case it belongs to "render" group, so my user should also belong to "render" group. I wasted days to find that out. Check if your group was invalid. If so, then add your user to the same group of renderD128 (in my case group "render"), and try if your above solution works. If not:
Configuration/Stream/Stream Profiles/Add:
Type: MPEG-TS Spawn/build-in
In General Settings: as you wish.
In Spawn Settings/Command line:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=720,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 1.5M -maxrate 2M -c:a libopus -b:a 32K pipe:1
Here's some description of that command:
-c:v hevc_vaapi
output format of video, in this case hevc. In my case it works, don't know if it will in yours. Others, like h264_vaapi, are listed in "Supported encoders" table on https://trac.ffmpeg.org/wiki/Hardware/VAAPI
h=720
720p vertical resolution.
-b:v 1.5M
average bandwidth of video, if I remember correctly.
-maxrate 2M
maximum bandwidth of video. If you cut this too short, video will be horrible.
-c:a libopus -b:a 64K
audio encoding with Opus and 64kbps. It can be also
-c:a copy
to just dump copy original audio without transcoding.
My ffmpeg is standalone ffmpeg from debian repository.
Here are couple of my profiles commandlines:
audio-only-opus:
ffmpeg -i - -f mpegts -vn -c:a libopus -b:a 28K -ac 1 pipe:1
hevc-vaapi-256p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=256,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 384K -maxrate 480K -c:a libopus -b:a 16K -ac 1 pipe:1
hevc-vaapi-320p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=320,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 384K -maxrate 512K -c:a libopus -b:a 16K -ac 1 pipe:1
hevc-vaapi-384p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=384,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 512K -maxrate 512K -c:a libopus -b:a 16K -ac 1 pipe:1
hevc-vaapi-480p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=480,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 512K -maxrate 512K -c:a libopus -b:a 16K -ac 1 pipe:1
hevc-vaapi-720p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=720,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 1.5M -maxrate 2M -c:a libopus -b:a 32K pipe:1
Hope this will help.