morpheus65535 / bazarr

Bazarr is a companion application to Sonarr and Radarr. It manages and downloads subtitles based on your requirements. You define your preferences by TV show or movie and Bazarr takes care of everything for you.
https://www.bazarr.media
GNU General Public License v3.0
2.78k stars 218 forks source link

Bazarr/ffmpeg Errno 22 - invalid argument while searching for subtitles #2641

Closed szymon3 closed 2 weeks ago

szymon3 commented 2 weeks ago

Describe the bug I have several providers set, including napiprojekt which successfully downloaded subtitles for another episodes of this TV show.

It is failing to download subtitles for couple of random episodes. All of them are from the same source and it doesn not look like filesystem permission issue, as all files have exactly the same permissions set.

To Reproduce Steps to reproduce the behavior:

  1. Search for subtitles for single episode (context menu)

Expected behavior Successfully download subtitles as for other episodes

Screenshots

image

Software (please complete the following information):

Additional context Logs:

Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,661 - root                             (71a077c006c0) :  DEBUG (pool:79) - BAZARR updating pools: {'series_1': SZAsyncProviderPool [6 providers (3 initialized; 0 discarded)], 'series_': SZAsyncProviderPool [5 providers (2 initialized; 0 discarded)], 'movie_1': SZAsyncProviderPool [5 providers (2 initialized; 0 discarded)], 'movie_': SZAsyncProviderPool [5 providers (2 initialized; 1 discarded)]}
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,662 - root                             (71a077c006c0) :  DEBUG (pool:44) - BAZARR updating pool: series_1
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,679 - subliminal_patch.core            (71a077c006c0) :  DEBUG (core:258) - Discarded providers: set() | New providers: {'podnapisi', 'wizdom', 'supersubtitles', 'yifysubtitles', 'tvsubtitles', 'napiprojekt'}
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,680 - subliminal_patch.core            (71a077c006c0) :  DEBUG (core:260) - Updated discarded providers: set()
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,680 - subliminal_patch.core            (71a077c006c0) :  DEBUG (core:264) - Removed providers: set()
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,680 - subliminal_patch.core            (71a077c006c0) :  DEBUG (core:120) - No provider config updates
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,680 - root                             (71a077c006c0) :  DEBUG (pool:103) - BAZARR pools update elapsed time: 18.42ms
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,680 - root                             (71a077c006c0) :  DEBUG (download:33) - BAZARR Searching subtitles for this file: /mnt/library/data/seriale/Fargo (2014) - SE - - [][bit][ ]/Season 03/Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,681 - subliminal_patch.core            (71a077c006c0) :  DEBUG (core:108) - Config changed. Restarting provider: podnapisi
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,716 - subliminal_patch.core            (71a077c006c0) :  DEBUG (core:118) - Providers with config updates: {'podnapisi'}
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,717 - subzero.video                    (71a077c006c0) :  DEBUG (video:60) - Parsing video: Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv, hints: {'title': 'Fargo', 'type': 'episode'}
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,717 - subliminal_patch.core            (71a077c006c0) :  INFO (core:842) - Determining basic video properties for 'Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv' in '/mnt/library/data/seriale/Fargo (2014) - SE - - [][bit][ ]/Season 03'
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,765 - subliminal_patch.core            (71a077c006c0) :  DEBUG (core:850) - GuessIt found: {
Aug 29 10:56:25 arrstack bazarr[14232]:     "title": "Fargo",
Aug 29 10:56:25 arrstack bazarr[14232]:     "year": 2014,
Aug 29 10:56:25 arrstack bazarr[14232]:     "edition": "Special",
Aug 29 10:56:25 arrstack bazarr[14232]:     "season": 3,
Aug 29 10:56:25 arrstack bazarr[14232]:     "episode_title": "Fargo",
Aug 29 10:56:25 arrstack bazarr[14232]:     "episode": 2,
Aug 29 10:56:25 arrstack bazarr[14232]:     "source": "Web",
Aug 29 10:56:25 arrstack bazarr[14232]:     "screen_size": "1080p",
Aug 29 10:56:25 arrstack bazarr[14232]:     "audio_codec": "AAC",
Aug 29 10:56:25 arrstack bazarr[14232]:     "audio_channels": "5.1",
Aug 29 10:56:25 arrstack bazarr[14232]:     "video_codec": "H.265",
Aug 29 10:56:25 arrstack bazarr[14232]:     "release_group": "Silence",
Aug 29 10:56:25 arrstack bazarr[14232]:     "container": "mkv",
Aug 29 10:56:25 arrstack bazarr[14232]:     "mimetype": "video/x-matroska",
Aug 29 10:56:25 arrstack bazarr[14232]:     "type": "episode"
Aug 29 10:56:25 arrstack bazarr[14232]: }
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,766 - subliminal_patch.core            (71a077c006c0) :  DEBUG (core:866) - Size is 1974340004
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,766 - root                             (71a077c006c0) :  ERROR (utils:55) - BAZARR Error ([Errno 22] Invalid argument: '/mnt/library/data/seriale/Fargo (2014) - SE - - [][bit][ ]/Season 03/Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv') trying to get video information for this file: /mnt/library/data/seriale/Fargo (2014) - SE - - [][bit][ ]/Season 03/Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv
Aug 29 10:56:25 arrstack bazarr[14232]: Traceback (most recent call last):
Aug 29 10:56:25 arrstack bazarr[14232]:   File "/opt/Bazarr/bazarr/subtitles/utils.py", line 41, in get_video
Aug 29 10:56:25 arrstack bazarr[14232]:     video = parse_video(path, hints=hints, skip_hashing=skip_hashing, dry_run=used_scene_name, providers=providers,
Aug 29 10:56:25 arrstack bazarr[14232]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 29 10:56:25 arrstack bazarr[14232]:   File "/opt/Bazarr/bazarr/../custom_libs/subzero/video.py", line 61, in parse_video
Aug 29 10:56:25 arrstack bazarr[14232]:     return scan_video(fn, hints=hints, dont_use_actual_file=dry_run, providers=providers,
Aug 29 10:56:25 arrstack bazarr[14232]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 29 10:56:25 arrstack bazarr[14232]:   File "/opt/Bazarr/bazarr/../custom_libs/subliminal_patch/core.py", line 886, in scan_video
Aug 29 10:56:25 arrstack bazarr[14232]:     video.hashes['napiprojekt'] = hash_napiprojekt(hash_path)
Aug 29 10:56:25 arrstack bazarr[14232]:                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 29 10:56:25 arrstack bazarr[14232]:   File "/opt/Bazarr/bazarr/../custom_libs/subliminal/utils.py", line 69, in hash_napiprojekt
Aug 29 10:56:25 arrstack bazarr[14232]:     with open(video_path, 'rb') as f:
Aug 29 10:56:25 arrstack bazarr[14232]:          ^^^^^^^^^^^^^^^^^^^^^^
Aug 29 10:56:25 arrstack bazarr[14232]: OSError: [Errno 22] Invalid argument: '/mnt/library/data/seriale/Fargo (2014) - SE - - [][bit][ ]/Season 03/Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,767 - root                             (71a077c006c0) :  DEBUG (download:131) - BAZARR Ended searching Subtitles for file: /mnt/library/data/seriale/Fargo (2014) - SE - - [][bit][ ]/Season 03/Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,767 - socketio.server                  (71a077c006c0) :  INFO (server:161) - emitting event "data" to all [/]
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,768 - engineio.server                  (71a077c006c0) :  INFO (socket:76) - mu3-bgiIut5qXomKAAAQ: Sending packet MESSAGE data 2["data",{"type":"episode","action":"update","payload":28}]
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,768 - engineio.server                  (71a077c006c0) :  INFO (socket:76) - yC7ja3U8nqqIWzS7AAAS: Sending packet MESSAGE data 2["data",{"type":"episode","action":"update","payload":28}]
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,769 - socketio.server                  (71a077c006c0) :  INFO (server:161) - emitting event "data" to all [/]
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,769 - engineio.server                  (71a077c006c0) :  INFO (socket:76) - mu3-bgiIut5qXomKAAAQ: Sending packet MESSAGE data 2["data",{"type":"message","action":"update","payload":"No PL subtitles found"}]
Aug 29 10:56:25 arrstack bazarr[14232]: 2024-08-29 10:56:25,769 - engineio.server                  (71a077c006c0) :  INFO (socket:76) - yC7ja3U8nqqIWzS7AAAS: Sending packet MESSAGE data 2["data",{"type":"message","action":"update","payload":"No PL subtitles found"}]
Aug 29 10:56:30 arrstack bazarr[14232]: 2024-08-29 10:56:30,513 - engineio.server                  (71a05ce006c0) :  INFO (socket:76) - yC7ja3U8nqqIWzS7AAAS: Sending packet PING data None
Aug 29 10:56:30 arrstack bazarr[14232]: 2024-08-29 10:56:30,534 - engineio.server                  (71a0682006c0) :  INFO (socket:39) - yC7ja3U8nqqIWzS7AAAS: Received packet PONG data
Aug 29 10:56:31 arrstack bazarr[14232]: 2024-08-29 10:56:31,396 - root                             (71a0bdc006c0) :  DEBUG (binaries:50) - BAZARR binary not found in path, searching for it...
Aug 29 10:56:31 arrstack bazarr[14232]: 2024-08-29 10:56:31,396 - root                             (71a0bdc006c0) :  DEBUG (binaries:75) - BAZARR found this in binaries.json: {'system': 'Linux', 'machine': 'x86_64', 'directory': 'ffmpeg', 'name': 'ffprobe', 'checksum': '29fdc34d9c7ad07c8f75e83d8fb5965b', 'url': 'https://github.com/morpheus65535/bazarr-binaries/raw/master/bin/Linux/x86_64/ffmpeg/ffprobe'}
Aug 29 10:56:31 arrstack bazarr[14232]: 2024-08-29 10:56:31,397 - root                             (71a0bdc006c0) :  DEBUG (binaries:78) - BAZARR returning this existing and up-to-date binary: /opt/Bazarr/bin/Linux/x86_64/ffmpeg/ffprobe

Directory files list with permissions:

$ ls -l
total 18529804
-rwxrwx--- 1 root lxc_shares 2545925354 Aug 28 15:35 'Fargo (2014) - S03E01 - The Law of Vacant Places [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares      43531 Aug 29 10:30 'Fargo (2014) - S03E01 - The Law of Vacant Places [WEBDL-1080p][AAC 5.1][x265]-Silence.pl.hi.srt'
-rwxrwx--- 1 root lxc_shares 1974340004 Aug 28 15:35 'Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares 1898820644 Aug 28 15:35 'Fargo (2014) - S03E03 - The Law of Non-Contradiction [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares 1922454733 Aug 28 19:47 'Fargo (2014) - S03E04 - The Narrow Escape Problem [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares 2261407188 Aug 28 19:47 'Fargo (2014) - S03E05 - The House of Special Purpose [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares 1731512174 Aug 28 19:47 'Fargo (2014) - S03E06 - The Lord of No Mercy [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares      20741 Aug 29 10:31 'Fargo (2014) - S03E06 - The Lord of No Mercy [WEBDL-1080p][AAC 5.1][x265]-Silence.pl.srt'
-rwxrwx--- 1 root lxc_shares 1699727917 Aug 28 19:47 'Fargo (2014) - S03E07 - The Law of Inevitability [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares      21991 Aug 29 10:31 'Fargo (2014) - S03E07 - The Law of Inevitability [WEBDL-1080p][AAC 5.1][x265]-Silence.pl.srt'
-rwxrwx--- 1 root lxc_shares 1956961301 Aug 28 19:47 'Fargo (2014) - S03E08 - Who Rules the Land of Denial [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares      18631 Aug 29 10:32 'Fargo (2014) - S03E08 - Who Rules the Land of Denial [WEBDL-1080p][AAC 5.1][x265]-Silence.pl.srt'
-rwxrwx--- 1 root lxc_shares 1923720694 Aug 28 19:47 'Fargo (2014) - S03E09 - Aporia [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares      25100 Aug 29 10:33 'Fargo (2014) - S03E09 - Aporia [WEBDL-1080p][AAC 5.1][x265]-Silence.pl.srt'
-rwxrwx--- 1 root lxc_shares 2003270382 Aug 28 19:47 'Fargo (2014) - S03E10 - Somebody to Love [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv'
-rwxrwx--- 1 root lxc_shares      20836 Aug 29 10:33 'Fargo (2014) - S03E10 - Somebody to Love [WEBDL-1080p][AAC 5.1][x265]-Silence.pl.srt'
morpheus65535 commented 2 weeks ago

File name passed to ffmpeg in the log: Fargo (2014) - SE - - [][bit][ ]/Season 03/Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv Filename in directory: Fargo (2014) - S03E02 - The Principle of Restricted Choice [WEBDL-1080p][AAC 5.1][x265]-Silence.mkv

Could it be that Bazarr haven't received the renamed file name from Sonarr?

szymon3 commented 2 weeks ago

The filename itself is the same in S03E02. My output of ls -l command was executed in Season 03 directory directly, that's why it's missing the renamed prefix path and could confuse you. Eventually Bazarr downloaded subtitles for S03E02 at some point (even automatically I think), but I face exactly the same issue now for another episode. For the sake of full informations about library I'm attaching few screenshots.

To me, all filenames are exactly the same (I compared them with copy -> paste and web browser search).

Sonarr: image Bazarr: image Filesystem: image

szymon3 commented 2 weeks ago

Update: I have found another error message in logs (which I missed before) from ffprobe saying:

BAZARR ffprobe cannot analyze this video file /mnt/library/data/seriale/Fargo (2014) - SE - - [][bit][ ]/Season 04/Fargo (2014) - S04E09 - East West [WEBDL-1080p][EAC3 5.1][h264]-STRONTiUM.mkv. Could it be corrupted?

I did "force recheck" the file in qBittorrent directly (for file integrity I believe) and redownloaded some small part of file again. After that, Bazarr successfully downloaded subtitles for the episode.

Confirmed the same behavior with another file (movie) in my library for which Bazarr was not able to find subtitles too. After rechecking and redownloading the file again, Bazarr downloaded subtitles without any issue.

Sorry for wasting your time, lesson learned. :)

morpheus65535 commented 2 weeks ago

Hehe no problem mate, I have learn some stuff to and it may help other in the future. Have a nice day!