VAAPI transcoding not working

Hi,

I’ve been trying to get VAAPI to work on my server, i believe it is configured correctly.

I have Plex pass
Plex server: Version 1.11.1.4768
OS: Ubuntu 16.04 64-Bit Server
I have installed the latest Intel graphics driver
My processor is:

I’ve installed ffmpeg to test the transcoding getting 6x speed compared to plex 1.5x

Any ideas?
Slow
ffmpeg -init_hw_device vaapi=vaapi0:/dev/dri/renderD128 -filter_hw_device vaapi0 -i \/dvd/videos/X/X.S04E01.Episode.1.mkv plextest.mp4

Fast
ben@my:~$ ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i /dvd/videos/X/X.S04E01.Episode.1.mkv -c:v h264_vaapi -b:v 2M -maxrate 2M plextest.mp4 ffmpeg version 3.4.1-1~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609 configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, matroska,webm, from '/dvd/videos/X/X.S04E01.Episode.1.mkv': Metadata: encoder : mkvmerge v6.1.0 ('Old Devil') built on Mar 2 2013 14:32:37 Duration: 00:57:32.40, start: 0.000000, bitrate: 2339 kb/s Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 50 tbc (default) Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default) File 'plextest.mp4' already exists. Overwrite ? [y/N] y libva info: VA-API version 0.39.4 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_0_39 libva info: va_openDriver() returns 0 Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi)) Stream #0:1 -> #0:1 (ac3 (native) -> aac (native)) Press [q] to stop, [?] for help Output #0, mp4, to 'plextest.mp4': Metadata: encoder : Lavf57.83.100 Stream #0:0(eng): Video: h264 (h264_vaapi) (High) (avc1 / 0x31637661), vaapi_vld, 1280x720 [SAR 1:1 DAR 16:9], q=0-31, 2000 kb/s, 25 fps, 12800 tbn, 25 tbc (default) Metadata: encoder : Lavc57.107.100 h264_vaapi Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default) Metadata: encoder : Lavc57.107.100 aac Unrepairable overflow!-0.0 size= 2816kB time=00:00:11.88 bitrate=1941.4kbits/s speed=4.71x frame= 2479 fps=147 q=-0.0 Lsize= 25170kB time=00:01:39.58 bitrate=2070.5kbits/s speed=5.91x video:23526kB audio:1575kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.275150% [aac @ 0x5555a0616120] Qavg: 603.935

I need:

  1. The Debug logs (settings - server - help - download logs) ZIP file collected after recreating the issue
  2. The XML (Hover over item - Get Info - View XML) with code paragraph formatting

To create the logs:

  1. Start Playback
  2. Let play for 15-20 seconds
  3. Stop Playback
  4. Wait an additional 15 seconds for logs to get to disk
  5. Capture the logs (#1 above)
  6. Attach here with the XML (#2)

Please see attached files included

This is a docker issue. Hardware transcoding in Docker containers requires special handling.

Moving this to the Docker forum.

In preparation , Please add the FULL ZIP , with Debug logging only. Verbose logging of the singular oldest file is insufficient.

Feb 07, 2018 22:45:49.260 [0x7f160dbfe700] INFO - Plex Media Server v1.11.1.4768-338ac2b75 - ubuntu docker x86_64 - build: linux-ubuntu-x86_64 ubuntu - GMT 00:00
Feb 07, 2018 22:45:49.261 [0x7f160dbfe700] INFO - Linux version: 4.4.0-112-generic (#135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018), language: en-US
Feb 07, 2018 22:45:49.261 [0x7f160dbfe700] INFO - Processor        Intel(R) Core(TM) i3-3220T CPU @ 2.80GHz

Sorry, the zip got quite big so i thought you might just want the most recent one

You did not follow my requested procedure.

  1. The logs were purged. This forum allows up to 25 MB / zip file to be uploaded. Typical PMS logs (full) are about 6 MB when ZIPped
  2. Your logs show a transcode already in progress… with the decision portion I need deleted.
Feb 07, 2018 23:21:36.043 [0x7f8afdffe700] INFO - Plex Media Server v1.11.1.4768-338ac2b75 - ubuntu docker x86_64 - build: linux-ubuntu-x86_64 ubuntu - GMT 00:00
Feb 07, 2018 23:21:36.043 [0x7f8afdffe700] INFO - Linux version: 4.4.0-112-generic (#135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018), language: en-US
Feb 07, 2018 23:21:36.043 [0x7f8afdffe700] INFO - Processor        Intel(R) Core(TM) i3-3220T CPU @ 2.80GHz
Feb 07, 2018 23:21:36.043 [0x7f8afdffe700] INFO - /usr/lib/plexmediaserver/Plex Media Server
Feb 07, 2018 23:21:36.042 [0x7f8ae6bf2700] DEBUG - Request: [127.0.0.1:43486 (Loopback)] PUT /video/:/transcode/session/2A1727F3-78D0-4C26-8702-F9C6646EA06D/35ab5a08-90c7-4c16-ac42-9f4eaf3b9b1a/progress?progress=50.3&size=-22&remaining=679&vdec_packets=495&vdec_sw_ok=489&speed=2.5&vdec_hw_status=0 (27 live) Signed-in Token (bentech)
Feb 07, 2018 23:21:36.043 [0x7f8afaffe700] DEBUG - Completed: [127.0.0.1:43486] 206 PUT /video/:/transcode/session/2A1727F3-78D0-4C26-8702-F9C6646EA06D/35ab5a08-90c7-4c16-ac42-9f4eaf3b9b1a/progress?progress=50.3&size=-22&remaining=679&vdec_packets=495&vdec_sw_ok=489&speed=2.5&vdec_hw_status=0 (27 live) 0ms 326 bytes
Feb 07, 2018 23:21:36.045 [0x7f8aee3fe700] DEBUG - Thread: Running async task started by thread 0x7f8afdffe700.
Feb 07, 2018 23:21:36.045 [0x7f8aee3fe700] DEBUG - Streaming Resource: Usage: 7986kbps of WAN bandwidth, 1 streaming transcode slots, and 0 static transcode slots across 2 sessions
Feb 07, 2018 23:21:36.083 [0x7f8ae8bf6700] DEBUG - Thread: Running async task started by thread 0x7f8afb7ff700.
Feb 07, 2018 23:21:36.083 [0x7f8ae8bf6700] DEBUG - Request: [92.10.136.255:61016 (WAN)] GET /video/:/transcode/universal/session/2A1727F3-78D0-4C26-8702-F9C6646EA06D/vtt-base/00121.vtt (27 live) TLS GZIP Signed-in
Feb 07, 2018 23:21:36.083 [0x7f8ae8bf6700] DEBUG - Asked for segment 121 from session.
  1. Stop ALL activity.
  2. Stop PMS
  3. Now purge the logs if you wish. Never purge logs while PMS is active.
  4. Start PMS
  5. Recreate the playback sequence again as requested above
  6. Attach full logs

What i did last time was.

Stop the server
Delete all the files in Logs
Start the server
Watch video for 15 seconds
Wait 15 seconds
Download Logs

I think all the files are there but Plex Media Server.1.log has the earlier events for some reason

It looks as if your logs failed to attach with this latest post

The previous attachment has the files, I can do it again but all the files you want were in the zip.

It just for some reason ordered the first part as .1.log

I know what it does. I have access to the source.

Please do what I ask, again, from scratch

I think it might have been PlexPy which caused the logs to get out of order

I found out what the issue was…

Plex requires the /dev/dri/* to have write permissions inside docker.

When i was testing it plex was running as a non root user inside the container

I’m fairly sure i don’t need the /usr/lib volume share

Here is an extract from docker compose:

  plex: 
    image: "linuxserver/plex"
    network_mode: "host"  
    volumes_from: 
      - "shares"
    volumes: 
      - "./configs/plex:/config"
      - "./temp/plex/transcode:/transcode"
      - "./temp/plex/sync:/config/Library/Application Support/Plex Media Server/Cache/Transcode/Sync+"
      - "/dvd:/dvd"
      - "/dvd2:/dvd2"
      - "/dvd3:/dvd3"
      - /usr/lib/x86_64-linux-gnu/dri/:/usr/lib/x86_64-linux-gnu/dri/
    ports: 
      - "32400:32400"
    environment: 
      - "VERSION=plexpass"
      - "PGID=1000"
      - "PUID=1000"
      - "TZ=Europe/London"
    devices: 
      - /dev/dri:/dev/dri
    onrun:
      - chmod -R 777 /dev/dri
    privileged: true
    restart: "always"