jellyfin / jellyfin

The Free Software Media System
https://jellyfin.org
GNU General Public License v2.0
34.68k stars 3.16k forks source link

[Issue]: Hardware Acceleration doesn't work - AMD Navi 31 (7900 XT) #10129

Closed guilty-p01nt3r closed 1 year ago

guilty-p01nt3r commented 1 year ago

I've configured Jellyfin to use hardware acceleration through VAAPI. The problem is that anytime ffmpeg transcodes or directStreams the workload on the CPU skyrockets. I've monitored processes on my GPU and its usage through nvtop but nothing jellyfin-related

Let me know if I can debug or get more detailed information

Thanks =)

Here additional useful logs:

Jellyfin is in render and video group:

~ > cat /etc/group | grep jellyfin

render:x:989:vince,jellyfin
video:x:985:greeter,jellyfin,vince
jellyfin:x:963:
~ > sudo vainfo --display drm --device /dev/dri/renderD128

Trying display: drm
vainfo: VA-API version: 1.19 (libva 2.19.0)
vainfo: Driver version: Mesa Gallium driver 23.1.5 for AMD Radeon RX 7900 XT (gfx1100, LLVM 15.0.7, DRM 3.52, 6.4.10-zen2-1-zen)
vainfo: Supported profile and entrypoints
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

~ > sudo /usr/lib/jellyfin-ffmpeg/ffmpeg -v debug -init_hw_device

opencl=ocl:.0,device_vendor="Advanced Micro Devices"
ffmpeg version 5.1.3-Jellyfin Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.152_89671bf)
  configuration: --prefix=/ffbuild/prefix --pkg-config=pkg-config --pkg-config-flags=--static --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --extra-version=Jellyfin --extra-cflags= --extra-cxxflags= --extra-ldflags= --extra-ldexeflags=-pie --extra-libs='-lfftw3f -lstdc++ -ldl' --enable-gpl --enable-version3 --enable-lto --disable-ffplay --disable-debug --disable-doc --disable-ptx-compression --disable-sdl2 --disable-libxcb --disable-xlib --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-chromaprint --enable-libvorbis --enable-opencl --enable-amf --enable-libdav1d --enable-libfdk-aac --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopenmpt --enable-libsrt --enable-libsvtav1 --enable-libdrm --enable-vaapi --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libzimg --enable-libzvbi
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'opencl=ocl:.0,device_vendor=Advanced Micro Devices'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option init_hw_device (initialise hardware device) with argument opencl=ocl:.0,device_vendor=Advanced Micro Devices.
[AVHWDeviceContext @ 0x563dbb8608c0] 1 OpenCL platforms found.
[AVHWDeviceContext @ 0x563dbb8608c0] 1 OpenCL devices found on platform "AMD Accelerated Parallel Processing".
[AVHWDeviceContext @ 0x563dbb8608c0] 0.0: AMD Accelerated Parallel Processing / gfx1100
[AVHWDeviceContext @ 0x563dbb8608c0] The cl_intel_va_api_media_sharing extension is required for QSV to OpenCL mapping.
[AVHWDeviceContext @ 0x563dbb8608c0] QSV to OpenCL mapping not usable.
Successfully parsed a group of options.
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
~ > sudo /usr/lib/jellyfin-ffmpeg/ffmpeg -v debug -init_hw_device drm=dr:/dev/dri/renderD128 -init_hw_device vulkan@dr

ffmpeg version 5.1.3-Jellyfin Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.152_89671bf)
  configuration: --prefix=/ffbuild/prefix --pkg-config=pkg-config --pkg-config-flags=--static --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --extra-version=Jellyfin --extra-cflags= --extra-cxxflags= --extra-ldflags= --extra-ldexeflags=-pie --extra-libs='-lfftw3f -lstdc++ -ldl' --enable-gpl --enable-version3 --enable-lto --disable-ffplay --disable-debug --disable-doc --disable-ptx-compression --disable-sdl2 --disable-libxcb --disable-xlib --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-chromaprint --enable-libvorbis --enable-opencl --enable-amf --enable-libdav1d --enable-libfdk-aac --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopenmpt --enable-libsrt --enable-libsvtav1 --enable-libdrm --enable-vaapi --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libzimg --enable-libzvbi
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'drm=dr:/dev/dri/renderD128'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'vulkan@dr'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option init_hw_device (initialise hardware device) with argument drm=dr:/dev/dri/renderD128.
[AVHWDeviceContext @ 0x561cd052f7c0] Opened DRM device /dev/dri/renderD128: driver amdgpu version 3.52.0.
Applying option init_hw_device (initialise hardware device) with argument vulkan@dr.
[AVHWDeviceContext @ 0x561cd0530d40] Supported validation layers:
[AVHWDeviceContext @ 0x561cd0530d40]    VK_LAYER_FROG_gamescope_wsi
[AVHWDeviceContext @ 0x561cd0530d40]    VK_LAYER_MANGOHUD_overlay_x86_64
[AVHWDeviceContext @ 0x561cd0530d40]    VK_LAYER_MESA_device_select
[AVHWDeviceContext @ 0x561cd0530d40]    VK_LAYER_MANGOAPP_overlay
[AVHWDeviceContext @ 0x561cd0530d40]    VK_LAYER_OBS_vkcapture_64
[AVHWDeviceContext @ 0x561cd0530d40]    VK_LAYER_INTEL_nullhw
[AVHWDeviceContext @ 0x561cd0530d40]    VK_LAYER_KHRONOS_validation
[AVHWDeviceContext @ 0x561cd0530d40]    VK_LAYER_MESA_overlay
[AVHWDeviceContext @ 0x561cd0530d40] GPU listing:
[AVHWDeviceContext @ 0x561cd0530d40]     0: AMD Radeon RX 7900 XT (RADV GFX1100) (discrete) (0x744c)
[AVHWDeviceContext @ 0x561cd0530d40] Requested device: 0x744c
[AVHWDeviceContext @ 0x561cd0530d40] Device 0 selected: AMD Radeon RX 7900 XT (RADV GFX1100) (discrete) (0x744c)
[AVHWDeviceContext @ 0x561cd0530d40] Queue families:
[AVHWDeviceContext @ 0x561cd0530d40]     0: graphics compute transfer sparse (queues: 1)
[AVHWDeviceContext @ 0x561cd0530d40]     1: compute transfer sparse (queues: 4)
[AVHWDeviceContext @ 0x561cd0530d40] Using device extension VK_KHR_push_descriptor
[AVHWDeviceContext @ 0x561cd0530d40] Using device extension VK_KHR_sampler_ycbcr_conversion
[AVHWDeviceContext @ 0x561cd0530d40] Using device extension VK_KHR_synchronization2
[AVHWDeviceContext @ 0x561cd0530d40] Using device extension VK_KHR_external_memory_fd
[AVHWDeviceContext @ 0x561cd0530d40] Using device extension VK_EXT_external_memory_dma_buf
[AVHWDeviceContext @ 0x561cd0530d40] Using device extension VK_EXT_image_drm_format_modifier
[AVHWDeviceContext @ 0x561cd0530d40] Using device extension VK_KHR_external_semaphore_fd
[AVHWDeviceContext @ 0x561cd0530d40] Using device extension VK_EXT_external_memory_host
[AVHWDeviceContext @ 0x561cd0530d40] Using device: AMD Radeon RX 7900 XT (RADV GFX1100)
[AVHWDeviceContext @ 0x561cd0530d40] Alignments:
[AVHWDeviceContext @ 0x561cd0530d40]     optimalBufferCopyRowPitchAlignment: 1
[AVHWDeviceContext @ 0x561cd0530d40]     minMemoryMapAlignment:              4096
[AVHWDeviceContext @ 0x561cd0530d40]     minImportedHostPointerAlignment:    4096
[AVHWDeviceContext @ 0x561cd0530d40] Using queue family 0 (queues: 1) for graphics
[AVHWDeviceContext @ 0x561cd0530d40] Using queue family 1 (queues: 4) for compute transfers
Successfully parsed a group of options.
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Jellyfin Version

10.8.z

if other:

No response

Environment

- OS:Arch Linux 
- Linux Kernel: 6.4.10-zen2-1-zen 
- Virtualization: No ( host daemon )
- Clients: Browser / Android Box
- Browser: Firefox 117
- FFmpeg Version: ffmpeg version 5.1.3-Jellyfin
- Playback Method: Direct Stream, Transcode
- Hardware Acceleration: VAAPI
- GPU Model: AMD Navi 31 (7900 XT) 
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking:
- Storage:

Jellyfin logs

No response

FFmpeg logs

/videos/c70a275a-b9e0-ee90-55e3-555e3236106e/hls1/main/139.ts

{"Protocol":0,"Id":"c70a275ab9e0ee9055e3555e3236106e","Path":"/mnt/1TB_Disk/tv_service/containerized/media/tv-sonarr/data/Hannibal/Season 1/Hannibal - S01E01 - Ap\u00E9ritif Bluray-1080p.mkv","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"mkv,webm","Size":3619373824,"Name":"Hannibal - S01E01 - Ap\u00E9ritif Bluray-1080p","IsRemote":false,"ETag":"f9c34ed29c500021dc342ab0656d342a","RunTimeTicks":25760000000,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"OpenToken":null,"RequiresClosing":false,"LiveStreamId":null,"BufferMs":null,"RequiresLooping":false,"SupportsProbing":true,"VideoType":0,"IsoType":null,"Video3DFormat":null,"MediaStreams":[{"Codec":"h264","CodecTag":null,"Language":"eng","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":"X264","VideoRange":"SDR","VideoRangeType":"SDR","VideoDoViTitle":null,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"DisplayTitle":"X264 - 1080p - H264 - SDR","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"ChannelLayout":null,"BitRate":11240291,"BitDepth":8,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"Height":1080,"Width":1920,"AverageFrameRate":24,"RealFrameRate":24,"Profile":"High","Type":1,"AspectRatio":"16:9","Index":0,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":"yuv420p","Level":41,"IsAnamorphic":null},{"Codec":"ac3","CodecTag":null,"Language":"ita","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":"HYBIDO 5.1 AC3 320k ITA -LOVE-","VideoRange":null,"VideoRangeType":null,"VideoDoViTitle":null,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"DisplayTitle":"HYBIDO 5.1 AC3 320k ITA -LOVE- - Italian - Dolby Digital - Default","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":"5.1","BitRate":320000,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":0,"AspectRatio":null,"Index":1,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null},{"Codec":"dts","CodecTag":null,"Language":"eng","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":"DTS","VideoRange":null,"VideoRangeType":null,"VideoDoViTitle":null,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"DisplayTitle":"DTS - English - 5.1","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":"5.1","BitRate":1536000,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":"DTS","Type":0,"AspectRatio":null,"Index":2,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null}],"MediaAttachments":[],"Formats":[],"Bitrate":13096291,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":null,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}

/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -ss 00:06:57.000 -init_hw_device vaapi=va:/dev/dri/renderD128 -filter_hw_device va -hwaccel vaapi -hwaccel_output_format vaapi -autorotate 0 -i file:"/mnt/1TB_Disk/tv_service/containerized/media/tv-sonarr/data/Hannibal/Season 1/Hannibal - S01E01 - Apéritif Bluray-1080p.mkv" -autoscale 0 -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -rc_mode VBR -b:v 292000 -maxrate 292000 -bufsize 584000 -profile:v:0 high -force_key_frames:0 "expr:gte(t,417+n_forced*3)" -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_vaapi=w=426:h=238:format=nv12:extra_hw_frames=24" -codec:a:0 libfdk_aac -ac 2 -ab 128000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 139 -hls_segment_filename "/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea.m3u8"

ffmpeg version 5.1.3-Jellyfin Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.152_89671bf)
  configuration: --prefix=/ffbuild/prefix --pkg-config=pkg-config --pkg-config-flags=--static --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --extra-version=Jellyfin --extra-cflags= --extra-cxxflags= --extra-ldflags= --extra-ldexeflags=-pie --extra-libs='-lfftw3f -lstdc++ -ldl' --enable-gpl --enable-version3 --enable-lto --disable-ffplay --disable-debug --disable-doc --disable-ptx-compression --disable-sdl2 --disable-libxcb --disable-xlib --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-chromaprint --enable-libvorbis --enable-opencl --enable-amf --enable-libdav1d --enable-libfdk-aac --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopenmpt --enable-libsrt --enable-libsvtav1 --enable-libdrm --enable-vaapi --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libzimg --enable-libzvbi
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, matroska,webm, from 'file:/mnt/1TB_Disk/tv_service/containerized/media/tv-sonarr/data/Hannibal/Season 1/Hannibal - S01E01 - Apéritif Bluray-1080p.mkv':
  Metadata:
    title           : Hannibal.s01e01.1080p.bluray.x264.HYBRID.5.1.ITA.ENG.LOVE
    encoder         : libebml v1.3.0 + libmatroska v1.4.0
    creation_time   : 2013-09-12T20:38:01.000000Z
  Duration: 00:42:56.00, start: 0.000000, bitrate: 11240 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 670.375000
      Metadata:
        title           : 00:00:00.000
    Chapter #0:1: start 670.375000, end 976.250000
      Metadata:
        title           : 00:11:10.375
    Chapter #0:2: start 976.250000, end 1357.292000
      Metadata:
        title           : 00:16:16.250
    Chapter #0:3: start 1357.292000, end 1712.708000
      Metadata:
        title           : 00:22:37.292
    Chapter #0:4: start 1712.708000, end 2299.167000
      Metadata:
        title           : 00:28:32.708
    Chapter #0:5: start 2299.167000, end 2576.000000
      Metadata:
        title           : 00:38:19.167
  Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 1k tbn (default)
    Metadata:
      title           : X264
  Stream #0:1(ita): Audio: ac3, 48000 Hz, 5.1(side), fltp, 320 kb/s (default)
    Metadata:
      title           : HYBIDO 5.1 AC3 320k ITA -LOVE-
  Stream #0:2(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Metadata:
      title           : DTS
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[h264_vaapi @ 0x559aa361dcc0] Driver does not support some wanted packed headers (wanted 0xd, found 0).
[h264_vaapi @ 0x559aa361dcc0] Driver does not support packed sequence headers, but a global header is requested.
[h264_vaapi @ 0x559aa361dcc0] No global header will be written: this may result in a stream which is not usable for some purposes (e.g. not muxable to some containers).
Output #0, hls, to '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea.m3u8':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: h264 (High), vaapi(bt709, progressive), 426x238 [SAR 1904:1917 DAR 16:9], q=2-31, 292 kb/s, 24 fps, 90k tbn (default)
    Metadata:
      encoder         : Lavc59.37.100 h264_vaapi
  Stream #0:1: Audio: aac, 48000 Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      encoder         : Lavc59.37.100 libfdk_aac
frame=    1 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea139.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea140.ts' for writing
frame=  303 fps=0.0 q=-0.0 size=N/A time=00:00:12.56 bitrate=N/A speed=21.7x    
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea141.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea142.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea143.ts' for writing
frame=  609 fps=564 q=-0.0 size=N/A time=00:00:25.47 bitrate=N/A speed=23.6x    
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea144.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea145.ts' for writing
frame=  900 fps=570 q=-0.0 size=N/A time=00:00:37.69 bitrate=N/A speed=23.9x    
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea146.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea147.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea148.ts' for writing
frame= 1213 fps=583 q=-0.0 size=N/A time=00:00:50.58 bitrate=N/A speed=24.3x    
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea149.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea150.ts' for writing
frame= 1512 fps=586 q=-0.0 size=N/A time=00:01:02.99 bitrate=N/A speed=24.4x    
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea151.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea152.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea153.ts' for writing
frame= 1810 fps=587 q=-0.0 size=N/A time=00:01:15.32 bitrate=N/A speed=24.4x    
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea154.ts' for writing
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea155.ts' for writing
frame= 2122 fps=592 q=-0.0 size=N/A time=00:01:28.59 bitrate=N/A speed=24.7x    
[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea156.ts' for writing

[q] command received. Exiting.

[hls @ 0x559aa36545c0] Opening '/mnt/1TB_Disk/jellyfin/config/transcodes/df50e2273e2a546f4717b73b9d4e0bea157.ts' for writing
frame= 2265 fps=593 q=-0.0 Lsize=N/A time=00:01:34.37 bitrate=N/A speed=24.7x    
video:3383kB audio:1485kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Please attach any browser or client logs here

No response

Please attach any screenshots here

image

(I've selected /usr/lib/jellyfin-ffmpeg/ffmpeg as ffmpeg path )

Code of Conduct

nyanmisaka commented 1 year ago

According to the logs, HWA is working fine.

HWA does not equal to zero CPU utilization, and your audio still needs to be transcoded by the CPU. However I don't understand how this leads to CPU skyrockets.

Stream #0:1 -> #0:1 (ac3 (native) -> aac (libfdk_aac))
guilty-p01nt3r commented 1 year ago

I checked while watching something on the phone. It is indeed using HWA through ffmpeg on the GPU. But the CPU usage is still quite high. (The skyrocketing happens more when It's transcoding a newly added movie)

I'll investigate what task is this CPU intensive. If anyone has some ideas, I can provide more data and logs.

Here some monitoring while watching something from the phone:

image

aljaxus commented 1 year ago

Can you see what's the (ffmpeg) command that's being run? I'd assume that it'd be quite useful to know.

guilty-p01nt3r commented 1 year ago

Yeah sure. I just launched a movie with quality selected lower than the original

The command is this beast over here:

ffmpeg \
-analyzeduration 200M \
-ss 00:10:33.000 \
-init_hw_device vaapi=va:/dev/dri/renderD128 \
-filter_hw_device va \
-hwaccel vaapi \
-autorotate 0 \
-canvas_size 1920x1080 \
-i file:/mnt/1TB_Disk/tv_service/containerized/media/radarr/data/Resident Evil Death Island (2023)/Resident Evil Death Island (2023) Unknown.m2ts \
-autoscale 0 \
-map_metadata -1 \
-map_chapters -1 \
-threads 0 \
-map 0:0 \
-map 0:2 \
-map \
-0:0 \
-codec:v:0 h264_vaapi \
-rc_mode VBR \
-b:v 77607191 \
-maxrate 77607191 \
-bufsize 155214382 \
-force_key_frames:0 expr:gte(t,633+n_forced*3) \
-filter_complex [0:9]scale=s=3840x2160:flags=fast_bilinear[sub];[0:0]setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,min(3840\,2160*a))/2)*2:trunc(min(max(iw/a\,ih)\,min(3840/a\,2160))/2)*2,format=nv12[main];[main][sub]overlay=eof_action=endall:shortest=1:repeatlast=0,hwupload=derive_device=vaapi \
-start_at_zero \
-codec:a:0 aac \
-ac 2 \
-ab 384000 \
-af volume=2 \
-copyts \
-avoid_negative_ts disabled \
-max_muxing_queue_size 2048 \
-f hls \
-max_delay 5000000 \
-hls_time 3 \
-hls_segment_type mpegts \
-start_number 211 \
-hls_segment_filename /mnt/1TB_Disk/jellyfin/config/transcodes/962e7866feb7135f530d64ff85d1248e%d.ts \
-hls_playlist_type vod \
-hls_list_size 0 \
-y /mnt/1TB_Disk/jellyfin/config/transcodes/962e7866feb7135f530d64ff85d1248e.m3u8
nyanmisaka commented 1 year ago

It seems the jellyfin-ffmpeg was not used for transcoding. Set ffmpeg path to/usr/lib/jellyfin-ffmpeg/ffmpeg and try again.

https://jellyfin.org/docs/general/administration/hardware-acceleration/amd#arch-linux

guilty-p01nt3r commented 1 year ago

Uh sorry about that, I was testing other instances of ffmpeg and forgot to switch back:

here is the command using the default jellyfin-ffmpeg

/usr/lib/jellyfin-ffmpeg/ffmpeg \
-analyzeduration 200M \
-ss 00:13:15.000 \
-init_hw_device vaapi=va:/dev/dri/renderD128 \
-filter_hw_device va \
-hwaccel vaapi \
-hwaccel_output_format vaapi \
-autorotate 0 \
-i file:/mnt/1TB_Disk/tv_service/containerized/media/tv-sonarr/data/Hannibal/Season 1/Hannibal \
- S01E01 \
- Apéritif Bluray-1080p.mkv \
-autoscale 0 \
-map_metadata -1 \
-map_chapters -1 \
-threads 0 \
-map 0:0 \
-map 0:1 \
-map -0:s \
-codec:v:0 h264_vaapi \
-rc_mode VBR \
-b:v 7616000 \
-maxrate 7616000 \
-bufsize 15232000 \
-profile:v:0 high \
-force_key_frames:0 expr:gte(t,795+n_forced*3) \
-vf setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_vaapi=format=nv12:extra_hw_frames=24 \
-codec:a:0 libfdk_aac -ac 2 -ab 384000 -af volume=2 \
-copyts \
-avoid_negative_ts disabled \
-max_muxing_queue_size 2048 -f hls \
-max_delay 5000000 \
-hls_time 3 \
-hls_segment_type mpegts \
-start_number 265 \
-hls_segment_filename /mnt/1TB_Disk/jellyfin/config/transcodes/35d3a08946cb2f7869d6516eec59440c%d.ts \
-hls_playlist_type vod \
-hls_list_size 0 \
-y /mnt/1TB_Disk/jellyfin/config/transcodes/35d3a08946cb2f7869d6516eec59440c.m3u8