Jellyfin Forum
GPU-Accelerated transcoding with 4K works, but not with 1080 - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: GPU-Accelerated transcoding with 4K works, but not with 1080 (/t-gpu-accelerated-transcoding-with-4k-works-but-not-with-1080)



GPU-Accelerated transcoding with 4K works, but not with 1080 - qdrop - 2023-12-25

Hi everyone.

I have a weird issue with Jellyfin (running in a Docker container within a LXD container):

While 4K media is properly transcoded using my internal AMD iGPU with almost zero load on the CPU, my 1080 content always taxes the CPU very hard; approx 30%.

4K file mediainfo:

Code:
General
Unique ID                                : <removed>
Complete name                            : <removed>
Format                                  : Matroska
Format version                          : Version 4
File size                                : 22.6 GiB
Duration                                : 2 h 21 min
Overall bit rate mode                    : Variable
Overall bit rate                        : 22.9 Mb/s
Encoded date                            : UTC 2018-10-18 18:56:02
Writing application                      : mkvmerge v23.0.0 ('The Bride Said No') 64-bit
Writing library                          : libebml v1.3.6 + libmatroska v1.4.9

Video
ID                                      : 1
Format                                  : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                          : Main 10@L5.1@High
HDR format                              : SMPTE ST 2086, HDR10 compatible
Codec ID                                : V_MPEGH/ISO/HEVC
Duration                                : 2 h 21 min
Bit rate                                : 17.0 Mb/s
Width                                    : 3 840 pixels
Height                                  : 1 600 pixels
Display aspect ratio                    : 2.40:1
Frame rate mode                          : Constant
Frame rate                              : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                      : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                      : 0.116
Stream size                              : 16.8 GiB (74%)
Writing library                          : x265 2.8+22-8f1d8a875bee:[Windows][GCC 6.3.0][64 bit] 10bit
Encoding settings                        : cpuid=1111039 / frame-threads=4 / numa-pools=16 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x1600 / interlace=0 / total-frames=203645 / level-idc=51 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / repeat-headers / annexb / aud / hrd / info / hash=0 / no-temporal-layers / no-open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / radl=0 / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / weightp / no-weightb / no-analyze-src-pics / deblock=-3:-3 / no-sao / no-sao-non-deblock / rd=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=17.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=160000 / vbv-bufsize=160000 / vbv-init=0.9 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=1 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=1 / chromaloc-top=2 / chromaloc-bottom=2 / display-window=0 / master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(11000000,0) / max-cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / opt-qp-pps / opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / hdr / hdr-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-mv-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei
Default                                  : Yes
Forced                                  : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0000 cd/m2, max: 1100 cd/m2


1080p file mediainfo:

Code:
General
Unique ID                                : <removed>
Complete name                            : <removed>
Format                                  : Matroska
Format version                          : Version 4
File size                                : 9.45 GiB
Duration                                : 2 h 37 min
Overall bit rate                        : 8 611 kb/s
Encoded date                            : UTC 2023-12-19 07:31:42
Writing application                      : mkvmerge v74.0.0 ('You Oughta Know') 64-bit
Writing library                          : libebml v1.4.4 + libmatroska v1.7.1

Video
ID                                      : 1
Format                                  : AVC
Format/Info                              : Advanced Video Codec
Format profile                          : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                  : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                : V_MPEG4/ISO/AVC
Duration                                : 2 h 37 min
Bit rate mode                            : Constant
Bit rate                                : 7 476 kb/s
Nominal bit rate                        : 10 000 kb/s
Width                                    : 1 920 pixels
Height                                  : 800 pixels
Display aspect ratio                    : 2.40:1
Frame rate mode                          : Constant
Frame rate                              : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                      : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                      : 0.203
Stream size                              : 8.21 GiB (87%)
Language                                : English
Default                                  : Yes
Forced                                  : No
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                : BT.709
Matrix coefficients                      : BT.709


docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/vainfo --display drm --device /dev/dri/renderD128

Code:
Trying display: drm
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_20
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.0)
vainfo: Driver version: Mesa Gallium driver 23.2.1 for AMD Radeon Vega 10 Graphics (raven, LLVM 15.0.7, DRM 3.54, 6.5.11-7-pve)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main              : VAEntrypointVLD
      VAProfileH264Main              : VAEntrypointEncSlice
      VAProfileH264High              : VAEntrypointVLD
      VAProfileH264High              : VAEntrypointEncSlice
      VAProfileHEVCMain              : VAEntrypointVLD
      VAProfileHEVCMain              : VAEntrypointEncSlice
      VAProfileHEVCMain10            : VAEntrypointVLD
      VAProfileJPEGBaseline          : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileNone                  : VAEntrypointVideoProc


Transcoding logs are attached as well, one can see clearly, when the acceleration is triggered within ffmpeg and when not; but why?! The codecs should be properly supported.

Any help is greatly appreciated.


RE: GPU-Accelerated transcoding with 4K works, but not with 1080 - TheDreadPirate - 2023-12-26

The 1080P log is direct streaming, video is untouched but the audio is transcoded.

Code:
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (libfdk_aac))

No video transcoding is occurring.


RE: GPU-Accelerated transcoding with 4K works, but not with 1080 - qdrop - 2023-12-26

Thank you for clarifying!

That explains quite a bit; but is this normal that audio transcoding uses 30% of my Ryzen 3750H CPU? Or is it rather the recomposing of the stream? Forcing the GPU to be used wouldn't change to load as the audio still will be transcoded with the CPU hm?


RE: GPU-Accelerated transcoding with 4K works, but not with 1080 - tmsrxzar - 2023-12-26

sidenote, your client may not require transcoding; if all you are doing is ac3->aac then your client is likely capable of ac3 but you've set the maximum allowed channels
doesn't fix the issue but would certainly avoid it


RE: GPU-Accelerated transcoding with 4K works, but not with 1080 - TheDreadPirate - 2023-12-26

(2023-12-26, 08:09 AM)qdrop Wrote: Thank you for clarifying!

That explains quite a bit; but is this normal that audio transcoding uses 30% of my Ryzen 3750H CPU? Or is it rather the recomposing of the stream? Forcing the GPU to be used wouldn't change to load as the audio still will be transcoded with the CPU hm?

Audio transcoding is a CPU task.  Depending on how fast your system can read and write your CPU will churn through the audio as fast as it can.  So you might have 30% CPU usage for like a minute as it churns through the audio at 50x real time.