support vaapi for transcoding
|Assignee:||John Törnblom||% Done:|
This was similar requested a few times but this is a different approach.
Tvh supports only nvenc (for Nvida GPUs) for hw accelerated transcoding, QSV is supported but (you need to patch/recompile your kernel with outdated patches + sign in for SDK ...) and was widely dropped in favor of vaapi that is supported by every Intel and AMD CPUs that are not older then ~6+ years that include an gpu.
So basically every low end CPU like the popular J1900,N3150,J3455 that are even at commercial NAS systems (Synology...) would be able to handle easily 2-3 Streams at the same time, the latest generation could even transcode H265 in real time without an problem.
Vaapi is completely integrated at the latest ffmpeg, Linux distributions support it also widely (because you only need the GPU driver) and even Tvh ffmpeg is getting build with --enable-vaapi.
What is missing:
Vaapi is used via command line switches, you can't just build ffmpeg with support for it and it works. full howto
ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i "input file" -vf 'format=nv12,hwupload' -map 0:0 -map 0:1 -threads 8 -aspect 16:9 -y -f matroska -acodec copy -b:v 12500k -vcodec 264_vaapi "output file"
- Tvh offers a way to specify the command line that is used for transcoding (user could tune it their self)
- Tvh adds a profile for vaapi (this could be problematic due the different systems with maybe different paths to dri render)
- redo the transcoding profiles or "merge" the codecs branch from here https://github.com/lekma/tvheadend/tree/codecs that is sadly not finished (but works) and was intended to pred to Tvh
#1 Updated by Jaroslav Kysela 6 days ago
Unfortunately, it seems that lekma has no time to work on the transcoding code and I have no ETA to port his changes to latest tvh. There's no such thing like command-line if you like to use the ffmpeg library directly - you have to build/use all things which the command line ffmpeg tool does.
The problem with the current tvh code is missing: "-vf 'format=nv12,hwupload'" and the /dev/dri device passing.
To be honest I have no real knowledge how ffmpeg gets called from Tvh, I thought Tvh calls ffmpeg with some command line - there it would be relatively easy to adjust the used command line to call ffmpeg. No idea if this works this way but at least would be some workaround till a proper solution is at the table.