Hardware Transcoding Under Linux. nvidia-docker

First off: Yes Yes, not supported. Blame me for being a techie working on mostly bleeding edge things, whatever.

System:
2x E5-2667v2
1080ti
Ubuntu

-> Have Docker 17.09 and nvidia-docker2 installed on it

So after a couple of hours of screwing around with Dockerfiles, drivers, videodecodingsoftware in the docker, I have managed to get this far:

Dec 06, 2017 18:56:41.517 [0x7f5a2afff700] ERROR - [FFMPEG] - No VA display found for device: /dev/dri/renderD128.
Dec 06, 2017 18:56:41.517 [0x7f5a2afff700] DEBUG - Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Invalid argument
Dec 06, 2017 18:56:41.517 [0x7f5a2afff700] DEBUG - Codecs: testing h264_nvenc (encoder)
Dec 06, 2017 18:56:41.529 [0x7f5a2afff700] VERBOSE - [FFMPEG] - Loaded Nvenc version 8.0
Dec 06, 2017 18:56:41.529 [0x7f5a2afff700] VERBOSE - [FFMPEG] - Nvenc initialized successfully
Dec 06, 2017 18:56:41.566 [0x7f5a2afff700] VERBOSE - [FFMPEG] - 1 CUDA capable devices found
Dec 06, 2017 18:56:41.566 [0x7f5a2afff700] VERBOSE - [FFMPEG] - [ GPU #0 - < GeForce GTX 1080 Ti > has Compute SM 6.1 ]
Dec 06, 2017 18:56:41.839 [0x7f5a2afff700] VERBOSE - [FFMPEG] - supports NVENC
Dec 06, 2017 18:56:42.587 [0x7f5a2afff700] VERBOSE - [FFMPEG] - Nvenc unloaded```


Can anyone tell me why it's unloading the NVENC after obviously finding the device to help it run the HW transcode? It's not really that verbose about why it is failing...

```<Variant id="c4ccae32-6434-4f0f-bffa-d5feb1b0d84e" targetBitrate="19862" context="streaming" sourceVideoCodec="hevc" sourceAudioCodec="ac3" videoDecision="transcode" audioDecision="transcode" subtitleDecision="burn" protocol="hls" container="mpegts" videoCodec="h264" audioCodec="aac" audioChannels="2" transcodeHwRequested="1" transcodeHwEncoding="nvenc" transcodeHwEncodingTitle="NVIDIA" transcodeHwFullPipeline="0">```

Is the transcode request btw

I’ve gotten the transcoder to not crash.

Nothing is showing in nvidia-smi though, and no HW encoding on host side is going on(no (hw) in plex server visible).
Even though NVENC is clearly being selected.
DEBUG - Streaming Resource: Reached Decision id=9465 codes=(General=1001,Direct play not available; Conversion OK. Direct Play=3000,App cannot direct play this item. Direct play is disabled. Transcode=1001,Direct play not available; Conversion OK.) media=(id=12282 part=(id=12320 decision=transcode container=mpegts protocol=hls streams=(Video=(id=15944 decision=transcode bitrate=18683 encoder=**h264_nvenc** width=1920 height=1080) Audio=(id=15946 decision=transcode bitrate=233 encoder=aac channels=2 rate=48000) Subtitle=(id=15947 decision=burn languageCode=eng location=embedded))))

Nevermind. I’m retarded.

It’s actually encoding the outgoing stream as expected. Just not decoding the original media, which is also normal as that is not a functionality Plex provides on Linux.

Well, so this works now but is hardly to write home about. Still no fluent 4k HEVC i guess.

@biebiep Any Chance of sharing your docker file ?

What changes did you have to make to the Docker image? Looking to implement something similar in CentOS and I am curious if I need to do a lot of tweaking.

@biebiep this looks interesting. Care to share?

@biebiep, this looks like exactly what i am trying to achieve.
How have you modified the container to achieve this?

Would love a write up on how you accomplished this!
Perhaps a docker-compose.yml file? :slight_smile: