Jellyfin Forum
Cannot play hardlinked file - 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: Cannot play hardlinked file (/t-cannot-play-hardlinked-file)



Cannot play hardlinked file - Knkr - 2024-01-28

Hello,

I'm looking for help with a strange behavior in jellyfin (and I have the same problem with emby as well).-> I cannot play hardlinked file.
See errors:
Code:
[2024-01-28 11:56:03.394 +00:00] [DBG] [40] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: "/usr/lib/jellyfin-ffmpeg/ffprobe" "-analyzeduration 200M -i file:\"/media/Videos/Films/xxx/xxx.mkv\" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"
[2024-01-28 11:56:03.394 +00:00] [DBG] [40] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting ffprobe with args "-analyzeduration 200M -i file:\"/media/Videos/Films/xxx/xxx.mkv\" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"
[2024-01-28 11:56:03.466 +00:00] [ERR] [40] MediaBrowser.Providers.Movies.MovieMetadataService: Error in "ffprobe"
MediaBrowser.Common.FfmpegException: ffprobe failed - streams and format are both null.
  at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken)
  at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken)
  at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken)
  at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken)

and 
Code:
[2024-01-28 11:56:04.582 +00:00] [ERR] [40] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL "POST" "/Items/1ec500d4-1bb8-0816-b037-45c2a8131321/PlaybackInfo".
System.NullReferenceException: Object reference not set to an instance of an object.
  at MediaBrowser.Model.Dlna.StreamBuilder.BuildVideoItem(MediaSourceInfo item, VideoOptions options)
  at MediaBrowser.Model.Dlna.StreamBuilder.BuildVideoItem(VideoOptions options)
  at Jellyfin.Api.Helpers.MediaInfoHelper.SetDeviceSpecificData(BaseItem item, MediaSourceInfo mediaSource, DeviceProfile profile, AuthorizationInfo auth, Nullable`1 maxBitrate, Int64 startTimeTicks, String mediaSourceId, Nullable`1 audioStreamIndex, Nullable`1 subtitleStreamIndex, Nullable`1 maxAudioChannels, String playSessionId, Guid userId, Boolean enableDirectPlay, Boolean enableDirectStream, Boolean enableTranscoding, Boolean allowVideoStreamCopy, Boolean allowAudioStreamCopy, IPAddress ipAddress)
  at Jellyfin.Api.Controllers.MediaInfoController.GetPostedPlaybackInfo(Guid itemId, Nullable`1 userId, Nullable`1 maxStreamingBitrate, Nullable`1 startTimeTicks, Nullable`1 audioStreamIndex, Nullable`1 subtitleStreamIndex, Nullable`1 maxAudioChannels, String mediaSourceId, String liveStreamId, Nullable`1 autoOpenLiveStream, Nullable`1 enableDirectPlay, Nullable`1 enableDirectStream, Nullable`1 enableTranscoding, Nullable`1 allowVideoStreamCopy, Nullable`1 allowAudioStreamCopy, PlaybackInfoDto playbackInfoDto)
  at lambda_method1025(Closure , Object )
  at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
  at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
  at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
  at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
  at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
  at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
  at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
  at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
  at Jellyfin.Server.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
  at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
  at Jellyfin.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
  at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
  at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
  at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
  at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

My config
- jellyfin 10.8.13 on docker
- radarr and sonarr (v3) on docker (with hardlink instead of copy checked and no remote path mapping)
- qbittorrent on docker
- jellyfin, radarr, sonarr and qbittorrent are on the same machine
- synology NAS on another machine, with a mount configured in the host with cifs: 
Code:
//a.b.c.d/Nas /media/nas cifs rw,vers=3.0,credentials=/root/.nas_credentials,dir_mode=0777,file_mode=0777,nobrl,mfsymlinks
. I tried multiple things here: with/without mfsymlinks, with correct permission (755), etc. Hard to remember all of them, but none worked Smiling-face

My use case:
1. Sonarr/radarr fetches something
2. It gets downloaded
3. Sonarr/radarr puts it at the correct place, for jellyfin to handle it.
4. Jellyfin can see the file

At this point this is working as expected, but jellyfin can only see the file. So in webapp or android app, I can see the media, but not quality or media duration for example. When trying to play, I get the error mentioned above.
I can see the hardlink (between the file in the download folder and the file in jellyfin library).
I can go inside my jellyfin container and run the ffprobe command without any error, I can also rename and delete the file (soit doesn't look like a permission issue).
I can also browse the SMB share (via windows or linux) and play the file using VLC without any issue.

As soon as seeding is over (either sonarr/radarr rule, or manually set in qbittorrent), the file is removed from the download folder and there is no more hardlink. At this point I can play the media.

Do you have any tips or configuration I could check to make this work ?

Thanks !


RE: Cannot play hardlinked file - TheDreadPirate - 2024-01-28

Why hard links instead of symlinks? IIRC hard links cannot span partitions. If that is what's happening that may be the problem.