linuxserver / docker-jellyfin

GNU General Public License v3.0
630 stars 94 forks source link

Hardware acceleration broken since 10.7.7-1-ls147 on GB-BACE-3150 / Intel N3150 #141

Closed u-cav closed 2 years ago

u-cav commented 2 years ago

linuxserver.io


Expected Behavior

When hardware transcoding is enabled, Jellyfin would correctly transcode files. Note that in the version 10.7.7-1-ls146 it's working perfectly fine.

Current Behavior

Starting from 10.7.7-1-ls147, hardware transcoding immediately fails.

It seems to be broken by PR #136, being the only change between 146 and 147 (see diff)

This error is shown:

Playback Error This client isn't compatible with the media and the server isn't sending a compatible media format.

Steps to Reproduce

  1. Have the correct hardware (?)
  2. Spin up a jellyfin container using image: ghcr.io/linuxserver/jellyfin:10.7.7-1-ls147
  3. Enable transcoding
  4. Start a video that needs transcoding, or reduce the quality to trigger it

Environment

OS: Arch Linux CPU architecture: x86_64 Intel(R) Celeron(R) CPU N3150 @ 1.60GHz lshw dump: lshw.txt How docker service was installed:

Docker and docker-compose installed from the distro repo

Command used to create docker container (run/create/compose/screenshot)

docker-compose snippet:

  jellyfin:
    image: ghcr.io/linuxserver/jellyfin
    container_name: jellyfin
    environment:
      - PUID=1004
      - PGID=1001
      - TZ=Europe/Rome
    volumes:
      - ./jellyfin/config:/config
      - (other media volumes)
    devices:
      - /dev/dri:/dev/dri
    restart: unless-stopped

started with docker-compose up -d

Docker logs

Jellyfin logs extract: jellyfin_logs.txt

The same command run inside the container: ffmpeg_logs.txt

github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

u-cav commented 2 years ago

This issue is still present. I am available for info and testing.

jim3ma commented 2 years ago

I think the problem is the updated drivers.

can you try this testing imagenyanmisaka/jellyfin:latest for hwa ?

u-cav commented 2 years ago

@jim3ma Thanks for the reply. It does seem like the issue is in the updated drivers. I tried nyanmisaka/jellyfin:latest, both as a drop-in to the current container, and as a clean deployment, but I cannot connect to the server. I'm getting some unrelated issues in the logs, which I think are preventing the service startup:

jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'ActivityLog' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'CustomItemDisplayPreferences' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'DisplayPreferences' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'HomeSection' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'ImageInfo' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'ItemDisplayPreferences' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'Permission' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'Preference' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'ApiKey' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'Device' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'DeviceOptions' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jellyfin-test  | [09:58:25] [WRN] [8] Microsoft.EntityFrameworkCore.Model.Validation: The entity type 'User' is configured to use schema 'jellyfin', but SQLite does not support schemas. This configuration will be ignored by the SQLite provider.
jim3ma commented 2 years ago

nyanmisaka/jellyfin:latest is used for official Dockerfile. I have verified. The latest jellyfin-ffmpeg will be okay to hwa. I'm waiting the new release.

u-cav commented 2 years ago

@jim3ma Sorry for the noise, those errors were unrelated and I had some cookies in my browser related to the previous instance.

I started a new instance with nyanmisaka/jellyfin:latest but I'm still getting the same errors:

Jellyfin logs:

jellyfin-test  | [14:33:03] [INF] [17] Jellyfin.Api.Helpers.TranscodingJobHelper: /usr/lib/jellyfin-ffmpeg/ffmpeg -init_hw_device vaapi=va:/dev/dri/renderD128 -filter_hw_device va -autorotate 0 -i file:"/data/file.mkv" -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 336000 -maxrate 336000 -bufsize 672000 -profile:v:0 high -force_key_frames:0 "expr:gte(t,0+n_forced*3)" -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*dar)\,426)/2)*2:trunc(ow/dar/2)*2,format=nv12,hwupload_vaapi" -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 0 -hls_segment_filename "/config/transcodes/e368adf3e4fa183b2eb9de133fdac2b5%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/transcodes/e368adf3e4fa183b2eb9de133fdac2b5.m3u8"
jellyfin-test  | [14:33:03] [ERR] [20] Jellyfin.Api.Helpers.TranscodingJobHelper: FFmpeg exited with code 1
jellyfin-test  | [14:33:03] [ERR] [20] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL GET /videos/aaee5545-f5e5-22ac-515d-8e292635f6c1/hls1/main/0.ts.
jellyfin-test  | MediaBrowser.Common.FfmpegException: FFmpeg exited with code 1
jellyfin-test  |    at Jellyfin.Api.Helpers.TranscodingJobHelper.StartFfMpeg(StreamState state, String outputPath, String commandLineArguments, HttpRequest request, TranscodingJobType transcodingJobType, CancellationTokenSource cancellationTokenSource, String workingDirectory)

ffmpeg command output (same command run inside the container):

Input #0, matroska,webm, from 'file:/data/file.mkv':
  Metadata:
    encoder         : libebml v1.3.6 + libmatroska v1.4.9
    creation_time   : 2018-07-27T10:53:56.000000Z
  Duration: 00:59:23.19, start: 0.000000, bitrate: 9387 kb/s
  Stream #0:0: Video: hevc (Main), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS-eng         : 8745260
      DURATION-eng    : 00:59:23.185000000
      NUMBER_OF_FRAMES-eng: 85431
      NUMBER_OF_BYTES-eng: 3895122600
      _STATISTICS_WRITING_APP-eng: mkvmerge v25.0.0 ('Prog Noir') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-07-27 10:53:56
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
    Metadata:
      BPS-eng         : 640000
      DURATION-eng    : 00:59:23.136000000
      NUMBER_OF_FRAMES-eng: 111348
      NUMBER_OF_BYTES-eng: 285050880
      _STATISTICS_WRITING_APP-eng: mkvmerge v25.0.0 ('Prog Noir') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-07-27 10:53:56
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 59
      DURATION-eng    : 00:58:46.223000000
      NUMBER_OF_FRAMES-eng: 946
      NUMBER_OF_BYTES-eng: 26084
      _STATISTICS_WRITING_APP-eng: mkvmerge v25.0.0 ('Prog Noir') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-07-27 10:53:56
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (eac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[AVHWDeviceContext @ 0x5583a5def100] libva: /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so init failed
Output #0, hls, to '/config/transcodes/dc189301d31aee4ffeb5b02a7dd8fd06.m3u8':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (High), vaapi_vld(tv, bt709, progressive), 426x238 [SAR 1904:1917 DAR 16:9], q=2-31, 336 kb/s, 23.98 fps, 90k tbn (default)
    Metadata:
      encoder         : Lavc58.134.100 h264_vaapi
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 384 kb/s (default)
    Metadata:
      encoder         : Lavc58.134.100 aac
[h264_vaapi @ 0x5583a5831440] Failed to sync to output buffer completion: 5 (invalid VAContextID).
Video encoding failed
[h264_vaapi @ 0x5583a5831440] Failed to sync to output buffer completion: 5 (invalid VAContextID).
[aac @ 0x5583a5830940] Qavg: 21057.707
[aac @ 0x5583a5830940] 2 frames left in the queue on closing
Conversion failed!
jim3ma commented 2 years ago

I think the problem is the compatibility between N3150 and the new jellyfin-ffmpeg. Rollback to old version, is hwa okay?

u-cav commented 2 years ago

Transcoding works fine in linuxserver/jellyfin:10.7.7-1-ls146. In this image, jellyfin-ffmpeg 4.3.1-4-focal is installed.

I downgraded jellyfin-ffmpeg to 4.3.1-4-bullseye inside nyanmisaka/jellyfin:220110-amd64 and nyanmisaka/jellyfin:latest , and I can confirm that transcoding works. It does seem like an issue with the new jellyfin-ffmpeg.

jim3ma commented 2 years ago

Transcoding works fine in linuxserver/jellyfin:10.7.7-1-ls146. In this image, jellyfin-ffmpeg 4.3.1-4-focal is installed.

I downgraded jellyfin-ffmpeg to 4.3.1-4-bullseye inside nyanmisaka/jellyfin:220110-amd64 and nyanmisaka/jellyfin:latest , and I can confirm that transcoding works. It does seem like an issue with the new jellyfin-ffmpeg.

So, report this issue to jellyfin-ffmpeg repo.

u-cav commented 2 years ago

Thank you for your help. I will open it there, since it is not a linuxserver-specific issue.