Jellyfin Forum
SOLVED: FFmpeg exited with code 140 / Stale file handle when accessing files from SMB share - 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: SOLVED: FFmpeg exited with code 140 / Stale file handle when accessing files from SMB share (/t-solved-ffmpeg-exited-with-code-140-stale-file-handle-when-accessing-files-from-smb-share)



FFmpeg exited with code 140 / Stale file handle when accessing files from SMB share - anubis genix - 2024-12-25

Hello,

I'm running Jellyfin 10.10.3 in a unprivileged Debian 12 Container on Proxmox.
While playback with hardware acceleration is working fine from local storage, playback from a SMB share is causing me some problems.

The SMB share is mounted via fstab and looks like this
//192.168.xx.xx/xxx/G_DRIVE /mnt/G_DRIVE cifs username=xxx,password=yyy,iocharset=utf8,vers=3.0,noperm 0 0

It's gettings passed through to the container with this command:
pct set 125 -mp0 /mnt/G_DRIVE,mp=/mnt/G_DRIVE

I can sucessfully browse the SMB share on the host and container and add those files to the media library in Jellyfin.
When playing the files, I get the following error messages:

[2024-12-25 13:37:17.502 +01:00] [INF] Starting "/usr/lib/jellyfin-ffmpeg/ffprobe" with args "-analyzeduration 200M -probesize 1G -i file:\"/mnt/G_DRIVE/file.mkv\" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"
[2024-12-25 13:37:17.546 +01:00] [ERR] Error in "Probe Provider"
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, Nullable1 videoType, CancellationToken cancellationToken)
  at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable
1 videoType, CancellationToken cancellationToken)
  at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken)
  at MediaBrowser.Providers.Manager.MetadataService2.RunCustomProvider(ICustomMetadataProvider1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken)
[2024-12-25 13:37:17.581 +01:00] [INF] User policy for "anubis". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[2024-12-25 13:37:17.801 +01:00] [INF] Deleting partial stream file(s) "/var/cache/jellyfin/transcodes/7f68db2b48b71af6b76eb5f99a891ee6.m3u8"
[2024-12-25 13:37:17.851 +01:00] [INF] Current HLS implementation doesn't support non-keyframe breaks but one is requested, ignoring that request
[2024-12-25 13:37:17.852 +01:00] [INF] "/usr/lib/jellyfin-ffmpeg/ffmpeg" "-analyzeduration 200M -probesize 1G -f matroska -init_hw_device vaapi=va:,vendor_id=0x8086,driver=iHD -init_hw_device qsv=qs@va -filter_hw_device qs -i file:\"/mnt/G_DRIVE/file.mkv\" -map_metadata -1 -map_chapters -1 -threads 0 -sn  -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 \"596714e9fd2a0b4b0771ce9a4a94d2be-1.mp4\" -start_number 0 -hls_base_url \"hls/596714e9fd2a0b4b0771ce9a4a94d2be/\" -hls_segment_filename \"/var/cache/jellyfin/transcodes/596714e9fd2a0b4b0771ce9a4a94d2be%d.mp4\" -hls_playlist_type event -hls_list_size 0 -y \"/var/cache/jellyfin/transcodes/596714e9fd2a0b4b0771ce9a4a94d2be.m3u8\""
[2024-12-25 13:37:17.902 +01:00] [ERR] FFmpeg exited with code 140
[2024-12-25 13:37:17.967 +01:00] [ERR] Error processing request. URL "GET" "/videos/702f3bdd-4050-c84e-ca7e-f738bf0c7596/live.m3u8".
MediaBrowser.Common.FfmpegException: FFmpeg exited with code 140

---

{"Protocol":0,"Id":"702f3bdd4050c84eca7ef738bf0c7596","Path":"/mnt/G_DRIVE/file.mkv","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"mkv","Size":null,"Name":"file","IsRemote":false,"ETag":"5d40af409bfa617824df8f540c1a9fd4","RunTimeTicks":null,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"UseMostCompatibleTranscodingProfile":false,"RequiresOpening":false,"OpenToken":null,"RequiresClosing":false,"LiveStreamId":null,"BufferMs":null,"RequiresLooping":false,"SupportsProbing":true,"VideoType":0,"IsoType":null,"Video3DFormat":null,"MediaStreams":[],"MediaAttachments":[],"Formats":[],"Bitrate":null,"FallbackMaxStreamingBitrate":null,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":0,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null,"HasSegments":false}

/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -probesize 1G -f matroska -init_hw_device vaapi=va:,vendor_id=0x8086,driver=iHD -init_hw_device qsv=qs@va -filter_hw_device qs -i file:"/mnt/G_DRIVE/file.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -sn  -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 "7f68db2b48b71af6b76eb5f99a891ee6-1.mp4" -start_number 0 -hls_base_url "hls/7f68db2b48b71af6b76eb5f99a891ee6/" -hls_segment_filename "/var/cache/jellyfin/transcodes/7f68db2b48b71af6b76eb5f99a891ee6%d.mp4" -hls_playlist_type event -hls_list_size 0 -y "/var/cache/jellyfin/transcodes/7f68db2b48b71af6b76eb5f99a891ee6.m3u8"


ffmpeg version 7.0.2-Jellyfin Copyright © 2000-2024 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto=auto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libxml2 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libharfbuzz --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      59.  8.100 / 59.  8.100
  libavcodec    61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample  5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
[in#0 @ 0x5e822e7953c0] Error opening input: Stale file handle
Error opening input file fileConfused-facemnt/G_DRIVE/file.mkv.
Error opening input files: Stale file handle


Any help would be appreciated.
Thanks in advance and happy holidays!


RE: FFmpeg exited with code 140 / Stale file handle when accessing files from SMB share - TheDreadPirate - 2024-12-26

In the container, are you able to see and access the file? In the container can you try running a checksum on the file?

Code:
md5sum /mnt/G_DRIVE/files.mkv



RE: FFmpeg exited with code 140 / Stale file handle when accessing files from SMB share - anubis genix - 2024-12-26

Found the fix for my issue in the Proxmox forum.

pvesm set <storage ID> --options noserverino