Transcoding on J5040 in Docker

Hi,

I recently purchased an Asrock J5040 itx motherboard which uses the Intel Pentium Silver J5040.
Before I had a Raspberry Pi and there were some files the Pi could just not transcode.

Video info for one of these files:
Title 1080p HEVC
Codec HEVC
Profile Main 10
Level 120
Resolution 1920x1080
Aspect ratio 16:9
Interlaced No
Framerate 23.976025
Bitrate 1112 kbps
Pixel format yuv420p10le
Ref frames 1

Happy to find out that my new setup can handle the transcode, BUT only on software transcoding.
I would like to have hardware transcoding of course, since this setup has a lot of encoding / decoding hardware options:

I run Jellyfin with docker, here’s a portion of the docker-compose:
devices:
- /dev/dri/renderD128:/dev/dri/renderD128
- /dev/dri/card0:/dev/dri/card0
environment:
PUID: 1000
PGID: 1000
TZ: Europe/Amsterdam
UMASK_SET: “022”
group_add:
- 109
- 44

The groups are for “video” and “render”.
When I try to hardware transcode (I use VAAPI), the sound is going okay but the video is not. I’m not sure how to explain it but I hope this screenshot will:

The video is not fluent, sometimes the screen is black, and then sometimes something like this above shows up.

System information:
OS: Ubuntu server 20.04 64bit
Jellyfin: 10.6.4 (tried the nightly build also, but the same result)

Does anyone have an idea where to search for the problem? My hours long trip on Google has not made me wiser. Thank you!