endrl / jellyfin-plugin-media-analyzer

Fingerprint audio to automatically detect intro and outro segments in Jellyfin
GNU General Public License v3.0
189 stars 10 forks source link

Analyze Media Task errors out a lot #6

Open Liangyiu opened 5 months ago

Liangyiu commented 5 months ago

Describe the bug

Hey this is my first issue report on GH, so sorry if something is missing.

So I set up the full compose stack as described here. Everything is working fine, besides some other plugins like Jellyscrub & some metadata providers not being compatible. The thing is every time I start the Analyze Media Task, I can count on it eventually running into this error listed below.

Has anyone else encountered this before and maybe knows of a fix?

Oh and another question: Is the analysing done on the graphics card? Nvidia HW Encoding is working for streams, but during the media analysing process nothing shows up in nvidia-smi. My server has a GTX 1660 Super

Operating system

Ubuntu 22.04.3 LTS

Jellyfin installation method

Docker in privileged LXC container

Support Bundle

FFmpeg version:

ffmpeg version 5.1.3-Jellyfin Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12 (Debian 12.2.0-14)
configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
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

Jellyfin logs

[2024-02-01 11:30:46.650 +00:00] [ERR] [25] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.AggregateException: One or more errors occurred. (One or more errors occurred. (start >= end: 0>=0 for segment itemId 'e28ffc5a-613b-a32a-30a5-b1a5abe16948' with type 'Intro.0'))
 ---> System.AggregateException: One or more errors occurred. (start >= end: 0>=0 for segment itemId 'e28ffc5a-613b-a32a-30a5-b1a5abe16948' with type 'Intro.0')
 ---> System.ArgumentException: start >= end: 0>=0 for segment itemId 'e28ffc5a-613b-a32a-30a5-b1a5abe16948' with type 'Intro.0'
   at Jellyfin.Server.Implementations.MediaSegments.MediaSegmentsManager.ValidateSegment(MediaSegment segment)
   at Jellyfin.Server.Implementations.MediaSegments.MediaSegmentsManager.CreateMediaSegmentsAsync(IEnumerable`1 segments)
   at Jellyfin.Server.Implementations.MediaSegments.MediaSegmentsManager.CreateMediaSegmentsAsync(IEnumerable`1 segments)
   at Jellyfin.Plugin.MediaAnalyzer.Plugin.SaveSegmentsAsync(Dictionary`2 segments, AnalysisMode mode)
   at Jellyfin.Plugin.MediaAnalyzer.Plugin.<>c__DisplayClass49_0.<<UpdateTimestamps>b__0>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Jellyfin.Plugin.MediaAnalyzer.Plugin.UpdateTimestamps(Dictionary`2 newTimestamps, AnalysisMode mode)
   at Jellyfin.Plugin.MediaAnalyzer.ChromaprintAnalyzer.AnalyzeMediaFiles(ReadOnlyCollection`1 analysisQueue, AnalysisMode mode, CancellationToken cancellationToken)
   at Jellyfin.Plugin.MediaAnalyzer.BaseItemAnalyzerTask.AnalyzeItems(ReadOnlyCollection`1 items, CancellationToken cancellationToken)
   at Jellyfin.Plugin.MediaAnalyzer.BaseItemAnalyzerTask.<>c__DisplayClass5_0.<AnalyzeItems>b__0(KeyValuePair`2 season)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at Jellyfin.Plugin.MediaAnalyzer.BaseItemAnalyzerTask.AnalyzeItems(IProgress`1 progress, CancellationToken cancellationToken)
   at Jellyfin.Plugin.MediaAnalyzer.AnalyzeMedia.ExecuteAsync(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
[2024-02-01 11:30:46.655 +00:00] [INF] [25] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Analyze Media" Failed after 3 minute(s) and 0 seconds
endrl commented 3 months ago

Thank you for your report. I will fix the bug with the next update. Currently just chromaprint is used (audio fingerprint) so no image processing for a gpu edit: there is a black detection, not sure if can speed that up.

My compose stack is using dotnet 7 but jellyfin stable is at dotnet 6 so you will have issues to run plugins compiled for jellyfin stable.