Open major-mayer opened 1 month ago
So I tried to discover some differences between Jellyfin's usage of FFMPEG and Memories'. I was using QSV before in Jellyfin, but now switched to VAAPI and it's still working (at least for H264). Here is the command in Memories:
2024/06/17 15:02:24 9wwyug98adf0-480p: /usr/local/bin/ffmpeg -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "xxx.mp4" -copyts -fflags +genpts -vf "format=nv12|vaapi,hwupload,scale_vaapi=force_original_aspect_ratio=decrease:format=nv12:w=854:h=854" -map "0:v:0" "-c:v" h264_vaapi -global_quality 30 -low_power 1 -map "0:a:0?" "-c:a" aac -ac 1 -start_number 0 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/9wwyug98adf0-3572383653/480p-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
And here in Jellyfin:
MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -probesize 1G -ss 00:07:54.000 -noaccurate_seek -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -i file:"/xxx.avi" -noautoscale -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 4787848 -maxrate 4787848 -bufsize 9575696 -profile:v:0 high -sei -a53_cc -force_key_frames:0 "expr:gte(t,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 256000 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type fmp4 -hls_fmp4_init_filename "84dc08317b85632aca45044e95c7d373-1.mp4" -start_number 158 -hls_segment_filename "/cache/transcodes/84dc08317b85632aca45044e95c7d373%d.mp4" -hls_playlist_type vod -hls_list_size 0 -y "/cache/transcodes/84dc08317b85632aca45044e95c7d373.m3u8"
In the case of Jellyfin, I don't get this [swscaler @ 0x561e7b058840] deprecated pixel format used, make sure you did set range correctly
error/ warning, so I guess there is something wrong with format=nv12:w=854:h=854
.
Also, I have a cleaner log go-vod
now, that is not as polluted with hardware initialization/ resource allocation errors:
2024/06/17 15:02:05 Starting go-vod 0.2.5 on :47788
2024/06/17 15:02:23 &{Version:0.2.5 Configured:true VersionMonitor:true Bind::47788 FFmpeg:/usr/local/bin/ffmpeg FFprobe:/usr/local/bin/ffprobe TempDir:/tmp/go-vod ChunkSize:3 LookBehind:3 GoalBufferMin:1 GoalBufferMax:4 StreamIdleTime:60 ManagerIdleTime:60 QF:30 VAAPI:true VAAPILowPower:true NVENC:false NVENCTemporalAQ:false NVENCScale:cuda UseTranspose:false ForceSwTranspose:false UseGopSize:false}
2024/06/17 15:02:24 9wwyug98adf0: new manager for /xxx.mp4
2024/06/17 15:02:24 9wwyug98adf0-480p: stopping stream
2024/06/17 15:02:24 9wwyug98adf0-480p: /usr/local/bin/ffmpeg -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "/xxx.mp4" -copyts -fflags +genpts -vf "format=nv12|vaapi,hwupload,scale_vaapi=force_original_aspect_ratio=decrease:format=nv12:w=854:h=854" -map "0:v:0" "-c:v" h264_vaapi -global_quality 30 -low_power 1 -map "0:a:0?" "-c:a" aac -ac 1 -start_number 0 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/9wwyug98adf0-3572383653/480p-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
2024/06/17 15:02:24 ffmpeg-error: [h264 @ 0x55e3358e6f40] Failed setup for format vaapi: hwaccel initialisation returned error.
2024/06/17 15:02:24 ffmpeg-error: [swscaler @ 0x55e338b618c0] deprecated pixel format used, make sure you did set range correctly
2024/06/17 15:02:24 ffmpeg-error: [swscaler @ 0x55e338ed78c0] deprecated pixel format used, make sure you did set range correctly
2024/06/17 15:02:35 9wwyug98adf0-720p: stopping stream
2024/06/17 15:02:35 9wwyug98adf0-720p: /usr/local/bin/ffmpeg -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "/xxx.mp4" -copyts -fflags +genpts -vf "format=nv12|vaapi,hwupload,scale_vaapi=force_original_aspect_ratio=decrease:format=nv12:w=1280:h=1280" -map "0:v:0" "-c:v" h264_vaapi -global_quality 30 -low_power 1 -map "0:a:0?" "-c:a" aac -ac 1 -start_number 0 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/9wwyug98adf0-3572383653/720p-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
2024/06/17 15:02:35 ffmpeg-error: [h264 @ 0x557596658f40] Failed setup for format vaapi: hwaccel initialisation returned error.
2024/06/17 15:02:35 ffmpeg-error: [swscaler @ 0x5575998d38c0] deprecated pixel format used, make sure you did set range correctly
2024/06/17 15:02:35 ffmpeg-error: [swscaler @ 0x557599c498c0] deprecated pixel format used, make sure you did set range correctly
2024/06/17 15:02:46 9wwyug98adf0-1080p: stopping stream
2024/06/17 15:02:46 9wwyug98adf0-1080p: /usr/local/bin/ffmpeg -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "/xxx.mp4" -copyts -fflags +genpts -vf "format=nv12|vaapi,hwupload,scale_vaapi=force_original_aspect_ratio=decrease:format=nv12:w=1920:h=1920" -map "0:v:0" "-c:v" h264_vaapi -global_quality 30 -low_power 1 -map "0:a:0?" "-c:a" aac -ac 1 -start_number 0 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/9wwyug98adf0-3572383653/1080p-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
2024/06/17 15:02:46 ffmpeg-error: [h264 @ 0x555d8d871f40] Failed setup for format vaapi: hwaccel initialisation returned error.
2024/06/17 15:02:46 ffmpeg-error: [swscaler @ 0x555d90aec8c0] deprecated pixel format used, make sure you did set range correctly
2024/06/17 15:02:46 ffmpeg-error: [swscaler @ 0x555d90e628c0] deprecated pixel format used, make sure you did set range correctly
2024/06/17 15:02:57 9wwyug98adf0-1440p: stopping stream
2024/06/17 15:02:57 9wwyug98adf0-1440p: /usr/local/bin/ffmpeg -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "/xxx.mp4" -copyts -fflags +genpts -vf "format=nv12|vaapi,hwupload,scale_vaapi=force_original_aspect_ratio=decrease:format=nv12:w=2560:h=2560" -map "0:v:0" "-c:v" h264_vaapi -global_quality 30 -low_power 1 -map "0:a:0?" "-c:a" aac -ac 1 -start_number 0 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/9wwyug98adf0-3572383653/1440p-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
2024/06/17 15:02:57 ffmpeg-error: [h264 @ 0x55c0b61cdf40] Failed setup for format vaapi: hwaccel initialisation returned error.
2024/06/17 15:02:57 ffmpeg-error: [swscaler @ 0x55c0b94488c0] deprecated pixel format used, make sure you did set range correctly
2024/06/17 15:02:57 ffmpeg-error: [swscaler @ 0x55c0b97be8c0] deprecated pixel format used, make sure you did set range correctly
2024/06/17 15:03:24 9wwyug98adf0-480p: stopping stream
2024/06/17 15:03:24 9wwyug98adf0-480p: ffmpeg exited with status: -1
2024/06/17 15:03:34 9wwyug98adf0-720p: stopping stream
2024/06/17 15:03:44 9wwyug98adf0-1080p: stopping stream
2024/06/17 15:03:54 9wwyug98adf0-1440p: stopping stream
2024/06/17 15:04:54 9wwyug98adf0: destroying manager
2024/06/17 15:04:54 9wwyug98adf0-720p: stopping stream
2024/06/17 15:04:54 9wwyug98adf0-1080p: stopping stream
2024/06/17 15:04:54 9wwyug98adf0-1440p: stopping stream
2024/06/17 15:04:54 9wwyug98adf0-480p: stopping stream
2024/06/17 15:04:54 9wwyug98adf0-max: stopping stream
2024/06/17 15:16:56 &{Version:0.2.5 Configured:true VersionMonitor:true Bind::47788 FFmpeg:/usr/local/bin/ffmpeg FFprobe:/usr/local/bin/ffprobe TempDir:/tmp/go-vod ChunkSize:3 LookBehind:3 GoalBufferMin:1 GoalBufferMax:4 StreamIdleTime:60 ManagerIdleTime:60 QF:30 VAAPI:false VAAPILowPower:true NVENC:false NVENCTemporalAQ:false NVENCScale:cuda UseTranspose:false ForceSwTranspose:false UseGopSize:false}
[swscaler @ 0x561e7b058840] deprecated pixel format used, make sure you did set range correctly
This is a harmless warning. It still seems to be unable to initialize the hardware.
go-vod actually uses the same image as jellyfin, but maybe it isn't new enough. I'd check if there's any difference in the way the device gets mounted to the container; no experience with this.
Hmm okay, then I don't know where the error comes from...
My config for Jellyfin and for Memories looks pretty much the same:
services:
jellyfin:
image: jellyfin/jellyfin
container_name: jellyfin
network_mode: "host"
user: 1000:1000
volumes:
- /mnt/data/jellyfin/config:/config
- /mnt/data/jellyfin/cache:/cache
- /mnt/data/filme:/media:ro
devices:
- /dev/dri/renderD128:/dev/dri/renderD128
restart: "unless-stopped"
environment:
- JELLYFIN_PublishedServerUrl=https://jellyfin.example
ports:
- 8096:8096/tcp
- 1900:1900/udp
- 7359:7359/udp
group_add:
- "107"
services:
go-vod:
image: radialapps/go-vod
init: true
restart: "unless-stopped"
environment:
- NEXTCLOUD_HOST=https://nc.example
devices:
- /dev/dri/renderD128:/dev/dri/renderD128
volumes:
- /mnt/data/ncfpm:/var/www/html:ro
group_add:
- "107"
ports:
- 47788:47788
One thing that i noticed, is that Memories (1st) creates a different "type of load" (?) when observing it with intel_gpu_top than Jellyfin (2nd) and my GPU doesn't seem to be able to handle this one:
So maybe the container image is too old indeed.
Describe the bug I recently installed an Intel ARC A380 GPU in my system to make use of AV1 hardware-accelerated encoding in Jellyfin. They have a very extensive documentation about how to set this up and in the end everything worked out fine.
Now I wanted to benefit from this success for the Memories app as well, but I am getting some errors in the process. I am not sure if AV1 encoding is supported at all, but if it's just H264 for now, that would be fine for me as well, if it would work. Unfortuantely that's not the case. When I activate hardware acceleration in the Memories settings (with or without low power QSV mode, which works well for Jellyfin), the videos just don't start playing anymore.
To Reproduce Steps to reproduce the behavior:
So I added the graphics card to the go-vod Docker container like this:
Then I activated the hardware encoding in Memories' settings like this:
I am exposing the go-vod port and use an IP address instead of the Docker Compose assigned hostname, because go-vod is running outside the VM, where Nextcloud is running (my host OS doesn't support GPU pass-through).
Then I start playing some videos.
Screenshots If applicable, add screenshots to help explain your problem.
Platform:
Additional context Client logs:
Go-vod logs (contains multiple tries):
Feel free to ask for more debug logs. I am happy to help :)