Jump to content

Xpenology Emby Transcoding on J4105 iGPU


frogger

Recommended Posts

solabc16

Thanks @@frogger, I'll pick this up again tomorrow. The output from 'vainfo' looks good, and confirms we have access to the GPU and it's responding as expected.

 

Best

-James

Link to comment
Share on other sites

solabc16

...one other thing, can you post a screenshot of the 'Media Info' for this video - you can find this at the bottom of the page for the video in the Web UI.

 

Best

- James

Link to comment
Share on other sites

solabc16

Hello @@frogger

 

We're going to need to iterate a little to pinpoint exactly what the issue is here. From the h/w detection logs, there are no material differences, attached for reference.

 

When running under Ubuntu, did you happen to notice the CPU utilisation whilst transcoding this file?

 

Can you run the following from an SSH session to your XPEnology system and post the output here:-

sudo /var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i file:"/volume1/data/test/BigBuckBunny_2000hevc.mp4" -f null -

This is a simple test to see if we're actually managing to decode the source file.

 

Best

- James

xpen_hardware_detection.txt

u1804_hardware_detection.txt

Link to comment
Share on other sites

When running under Ubuntu, did you happen to notice the CPU utilisation whilst transcoding this file?

 

Yes, I've been monitoring it using htop and intel_gpu_top. Neither showed any significant change in utilization during playback, which might be caused by the shortness of the video in combination with the update interval of these tools.

 

 

Can you run the following from an SSH session to your XPEnology system and post the output here:

sudo /var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i file:"/volume1/data/test/BigBuckBunny_2000hevc.mp4" -f null -
Password:
ffmpeg version 4.0.2-emby_2018_12_09-20181220T011603UTC Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --prefix=/var/packages/EmbyServer/target/ffmpeg --enable-cross-compile --cross-prefix=x86_64-syno-linux-gnu- --target-os=linux --disable-rpath --enable-pthreads --arch=x86_64 --enable-libzimg --enable-libmfx --enable-vaapi --enable-x86asm --enable-gpl --enable-shared --disable-static --disable-debug --disable-ffplay --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --enable-gnutls --enable-libass --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libfreetype --enable-fontconfig --enable-gray --enable-libfribidi --enable-libvidstab --enable-libzvbi --disable-indev=sndio --disable-outdev=sndio --extra-version=20181220T011603UTC --extra-libs='-luuid -lstdc++'
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/volume1/data/test/BigBuckBunny_2000hevc.mp4':
  Metadata:
    major_brand     : iso4
    minor_version   : 1
    compatible_brands: iso4hvc1
    creation_time   : 2014-08-25T21:13:56.000000Z
  Duration: 00:00:10.00, start: 0.083333, bitrate: 2013 kb/s
    Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv), 3840x2160, 2010 kb/s, 24 fps, 24 tbr, 24k tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2014-08-25T21:13:56.000000Z
      handler_name    : hevc:fps=24@GPAC0.5.1-DEV-rev4807
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : iso4
    minor_version   : 1
    compatible_brands: iso4hvc1
    encoder         : Lavf58.12.100
    Stream #0:0(und): Video: wrapped_avframe, vaapi_vld, 3840x2160, q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2014-08-25T21:13:56.000000Z
      handler_name    : hevc:fps=24@GPAC0.5.1-DEV-rev4807
      encoder         : Lavc58.18.100 wrapped_avframe
frame=  240 fps=0.0 q=-0.0 Lsize=N/A time=00:00:10.00 bitrate=N/A speed=38.1x
video:126kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Link to comment
Share on other sites

solabc16

Thanks @@frogger

 

Ok, next can we try the following :-

sudo /var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i file:"/volume1/data/test/BigBuckBunny_2000hevc.mp4" -vf 'deinterlace_vaapi=rate=field:auto=1,scale_vaapi=w=640:h=360,hwdownload,format=nv12' -c:v libx264 -crf 20 file:"/volume1/data/test/BigBuckBunny_2000x264.mp4"

Best

- James

Link to comment
Share on other sites


sudo /var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i file:"/volume1/data/test/BigBuckBunny_2000hevc.mp4" -vf 'deinterlace_vaapi=rate=field:auto=1,scale_vaapi=w=640:h=360,hwdownload,format=nv12' -c:v libx264 -crf 20 file:"/volume1/data/test/BigBuckBunny_2000x264.mp4"
ffmpeg version 4.0.2-emby_2018_12_09-20181220T011603UTC Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --prefix=/var/packages/EmbyServer/target/ffmpeg --enable-cross-compile --cross-prefix=x86_64-syno-linux-gnu- --target-os=linux --disable-rpath --enable-pthreads --arch=x86_64 --enable-libzimg --enable-libmfx --enable-vaapi --enable-x86asm --enable-gpl --enable-shared --disable-static --disable-debug --disable-ffplay --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --enable-gnutls --enable-libass --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libfreetype --enable-fontconfig --enable-gray --enable-libfribidi --enable-libvidstab --enable-libzvbi --disable-indev=sndio --disable-outdev=sndio --extra-version=20181220T011603UTC --extra-libs='-luuid -lstdc++'
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/volume1/data/test/BigBuckBunny_2000hevc.mp4':
Metadata:
major_brand : iso4
minor_version : 1
compatible_brands: iso4hvc1
creation_time : 2014-08-25T21:13:56.000000Z
Duration: 00:00:10.00, start: 0.083333, bitrate: 2013 kb/s
Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv), 3840x2160, 2010 kb/s, 24 fps, 24 tbr, 24k tbn, 24 tbc (default)
Metadata:
creation_time : 2014-08-25T21:13:56.000000Z
handler_name : hevc:fps=24@GPAC0.5.1-DEV-rev4807
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x6f5140] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x6f5140] profile High, level 3.1
[libx264 @ 0x6f5140] 264 - core 155 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'file:/volume1/data/test/BigBuckBunny_2000x264.mp4':
Metadata:
major_brand : iso4
minor_version : 1
compatible_brands: iso4hvc1
encoder : Lavf58.12.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), nv12, 640x360, q=-1--1, 48 fps, 12288 tbn, 48 tbc (default)
Metadata:
creation_time : 2014-08-25T21:13:56.000000Z
handler_name : hevc:fps=24@GPAC0.5.1-DEV-rev4807
encoder : Lavc58.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 476 fps=0.0 q=-1.0 Lsize= 17kB time=00:00:09.89 bitrate= 14.1kbits/s speed=10.4x
video:11kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 59.926872%
[libx264 @ 0x6f5140] frame I:2 Avg QP: 6.50 size: 102
[libx264 @ 0x6f5140] frame P:120 Avg QP: 8.14 size: 28
[libx264 @ 0x6f5140] frame B:354 Avg QP:12.33 size: 19
[libx264 @ 0x6f5140] consecutive B-frames: 0.8% 0.0% 0.0% 99.2%
[libx264 @ 0x6f5140] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x6f5140] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:100.0%
[libx264 @ 0x6f5140] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.0% 0.0% 0.0% direct: 0.0% skip:100.0%
[libx264 @ 0x6f5140] 8x8 transform intra:0.0%
[libx264 @ 0x6f5140] coded y,uvDC,uvAC intra: 0.0% 0.1% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x6f5140] i16 v,h,dc,p: 96% 0% 4% 0%
[libx264 @ 0x6f5140] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 @ 0x6f5140] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x6f5140] kb/s:8.28

Link to comment
Share on other sites

solabc16

Thanks @@frogger - sorry, forgot to add can you make sure the file generated (/volume1/data/test/BigBuckBunny_2000x264.mp4) can be played and looks correct.

 

Best

- James

Link to comment
Share on other sites

solabc16

Hi @@frogger - ok, that's good (well, as far as troubleshooting goes) and likely explains why the 'mpegts' output fails.

 

@solabc16 would it be helpful to you to have access to the testbox?

 

If this is possible, that'd be awesome and much appreciated - feel free to PM me with details.

 

Best

- James

Link to comment
Share on other sites

solabc16

...and another test, can you check the output file again as well please:-

sudo /var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -vaapi_device /dev/dri/renderD128 -i file:"/volume1/data/test/BigBuckBunny_2000hevc.mp4" -vf 'format=nv12,hwupload' -c:v h264_vaapi -qp 18 file:"/volume1/data/test/BigBuckBunny_2000x264.mp4"

Best

- James

Link to comment
Share on other sites

@@solabc16 - didn't work, size is 262byte

sudo /var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -vaapi_device /dev/dri/renderD128 -i file:"/volume1/data/test/BigBuckBunny_2000hevc.mp4" -vf 'format=nv12,hwupload' -c:v h264_vaapi -qp 18 file:"/volume1/data/test/BigBuckBunny_2000x264.mp4"
ffmpeg version 4.0.2-emby_2018_12_09-20181220T011603UTC Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --prefix=/var/packages/EmbyServer/target/ffmpeg --enable-cross-compile --cross-prefix=x86_64-syno-linux-gnu- --target-os=linux --disable-rpath --enable-pthreads --arch=x86_64 --enable-libzimg --enable-libmfx --enable-vaapi --enable-x86asm --enable-gpl --enable-shared --disable-static --disable-debug --disable-ffplay --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --enable-gnutls --enable-libass --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libfreetype --enable-fontconfig --enable-gray --enable-libfribidi --enable-libvidstab --enable-libzvbi --disable-indev=sndio --disable-outdev=sndio --extra-version=20181220T011603UTC --extra-libs='-luuid -lstdc++'
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/volume1/data/test/BigBuckBunny_2000hevc.mp4':
  Metadata:
    major_brand     : iso4
    minor_version   : 1
    compatible_brands: iso4hvc1
    creation_time   : 2014-08-25T21:13:56.000000Z
  Duration: 00:00:10.00, start: 0.083333, bitrate: 2013 kb/s
    Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv), 3840x2160, 2010 kb/s, 24 fps, 24 tbr, 24k tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2014-08-25T21:13:56.000000Z
      handler_name    : hevc:fps=24@GPAC0.5.1-DEV-rev4807
File 'file:/volume1/data/test/BigBuckBunny_2000x264.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_vaapi))
Press [q] to stop, [?] for help
Output #0, mp4, to 'file:/volume1/data/test/BigBuckBunny_2000x264.mp4':
  Metadata:
    major_brand     : iso4
    minor_version   : 1
    compatible_brands: iso4hvc1
    encoder         : Lavf58.12.100
    Stream #0:0(und): Video: h264 (h264_vaapi) (High) (avc1 / 0x31637661), vaapi_vld, 3840x2160, q=0-31, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2014-08-25T21:13:56.000000Z
      handler_name    : hevc:fps=24@GPAC0.5.1-DEV-rev4807
      encoder         : Lavc58.18.100 h264_vaapi
frame=  240 fps= 42 q=-0.0 Lsize=       0kB time=00:00:09.91 bitrate=   0.2kbits/s speed=1.74x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Link to comment
Share on other sites

@@solabc16, I've been digging through the Xpenology log files once again I've noticed the following lines in the dmesg log:

[   25.740919] [drm] GPU HANG: ecode 9:0:0xfffffffe, reason: hang on rcs0, bcs0, vcs0, vecs0, action: reset
[   25.740954] i915 0000:00:02.0: Resetting rcs0 for hang on rcs0, bcs0, vcs0, vecs0
[   25.741106] i915 0000:00:02.0: Resetting bcs0 for hang on rcs0, bcs0, vcs0, vecs0
[   25.741281] i915 0000:00:02.0: Resetting vcs0 for hang on rcs0, bcs0, vcs0, vecs0
[   25.741415] i915 0000:00:02.0: Resetting vecs0 for hang on rcs0, bcs0, vcs0, vecs0
[   31.736837] i915 0000:00:02.0: Resetting chip for hang on rcs0, bcs0, vcs0, vecs0
[   31.736868] i915 0000:00:02.0: GPU recovery failed
[   31.752936] [drm] Initialized i915 1.6.0 20180514 for 0000:00:02.0 on minor 0
[   31.754027] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
[   31.754647] acpi device:54: registered as cooling_device4
[   31.754728] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input1
[   31.783390] i915 0000:00:02.0: fb0: inteldrmfb frame buffer device

So the GPU is haning, resetting and then fails to recover and yet it gets initialized and /dev/dri/ gets populated.

The Ubuntu dmesg log shows no such resetting attempts.

 

I've found some alleged workaround for similar errors by setting kernel parameter in grub.cfg (i915.modeset=1 i915.enable_rc6=0, etc.) but none of those worked so far.

 

Since I can't find any complete documentation on what they mean to control, I've started looking at the kernel source and the i915 implementation comparing them between kernel 4.4.59 (DS918+) and 4.15.0 (Ubuntu 18.04 Live). Maybe there's some undocumented setting that helps...

Link to comment
Share on other sites

  • 2 weeks later...

Hi @@solabc16,

 

thanks for the update! I had some busy weeks at work myself.

I think I've made some progress in finding the cause of the issue and maybe a solution, though.

 

Like I said in my previous post, I started looking into the kernel sources and compared them between kernel Versions (i.e. the non-working Xpenology and the working Ubuntu version) and following the implementation across kernel modules. Which was demanding but enlightening!

 

To make a long story short, it boils down to how errors are handled by the "old" i915 driver and how this is influenced by GPU virtualization implementation (IOMMU).

 

So, I've strong indication that the transcoding issue is related to Intel's Virtualization Direct I/O.

From what I know, this should be disableable in the BIOS, but I didn't have time to confirm this on the board yet.

Link to comment
Share on other sites

  • 1 month later...
solabc16

Hello @@frogger

 

Thanks for the above, did you manage to identify whether or not it was 'Virtualization Direct I/O' support causing the issue?

 

Best

- James

Link to comment
Share on other sites

frogger

Hi @@solabc16,

 

yes, I can confirm that disabling vd-t (Virtualization Direct I/O) in the bios settings resolves the issue.

Thank you all for your help to narrow it down to this! :)

 

Best

- F

Link to comment
Share on other sites

solabc16

Thanks for the update @@frogger, appreciated - great to hear that solved it.

 

I'm sure this will help a number of other users, as this is likely to be the default setting on many systems.

 

Best

- James

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...