HaveAGitGat / Tdarr

Tdarr - Distributed transcode automation using FFmpeg/HandBrake + Audio/Video library analytics + video health checking (Windows, macOS, Linux & Docker)
2.72k stars 89 forks source link

Error demuxing input file 0: Invalid argument on many files #957

Closed dark2phoenix closed 2 months ago

dark2phoenix commented 4 months ago

Describe the bug Around 2023-12 I started getting lots of transcoded movies and TV shows truncated after transcoding. Files that were 3.9GB became 1.7 MB. First glance at the logs and everything looks OK. However, if look deeply at the transcoding section I see:

"Error demuxing input file 0: Invalid argument" in many of the files.

Doesn't happen every time, and doesn't happen consistently on the same files, but it's happening to about 40%+ of transcodes recently.

To Reproduce Download a movie or tv show and let Tdarr transcode it.

Expected behavior Transcodes to be 100% complete (i.e. whole file is available at the end). Perhaps Tdarr to failt the transcode when an error like this occurs.

Screenshots If applicable, add screenshots to help explain your problem.

tdarr_error_report

Please provide the following information:

Tdarr_Server_Config.json { "serverPort": "8266", "webUIPort": "8265", "serverIP": "0.0.0.0", "handbrakePath": "", "ffmpegPath": "", "logLevel": "INFO", "mkvpropeditPath": "", "ccextractorPath": "", "openBrowser": true, "cronPluginUpdate": "" }

aPJ-PVSzm-log.txt p7gWU2paK-log.txt sG4Cx8RXI5l-log.txt

-Worker error [can be found on the 'Tdarr' tab by pressing the 'i' button on a failed item in the staged file section or in the transcode error section at the bottom]

2024-01-23T16:23:48.287Z Error demuxing input file 0: Invalid argument

2024-01-23T16:23:48.287Z //diskstation.storage.mccannical.net/TVShows/Masters of Sex (2013) [imdb-tt2137109]/Season 04/Masters of Sex (2013) - S04E06 - Family Only [Bluray-1080p Remux][DTS-HD MA 5.1][AVC]-EPSiLON.mkv: Invalid argument

Additional context Add any other context about the problem here. I cannot think of something I changed on the configuration for the server or the client aside from updating to "the latest" the week or so before this started happening. I have seen files that fail work when I do it later, and some files fail 2-4 times before they work. I change nothing, Just go to Sonarr/Radarr and delete the tiny files and tell it to grab the same release again.

dark2phoenix commented 4 months ago

PS D:\tdarr\ffmpeg\bin> .\ffmpeg.exe -version ffmpeg version 6.1.1-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers built with gcc 12.2.0 (Rev10, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 58. 29.100 / 58. 29.100 libavcodec 60. 31.102 / 60. 31.102 libavformat 60. 16.100 / 60. 16.100 libavdevice 60. 3.100 / 60. 3.100 libavfilter 9. 12.100 / 9. 12.100 libswscale 7. 5.100 / 7. 5.100 libswresample 4. 12.100 / 4. 12.100 libpostproc 57. 3.100 / 57. 3.100

dark2phoenix commented 4 months ago

Reprocessed every file on that list last night. 3 of them failed again, but the rest succeeded. The remaining 3 succeeded on the 3rd attempt

dark2phoenix commented 4 months ago

So I think this may be related to using my GPU for gaming at the same time it's trying to transcode. I altered the node to only process in the middle of the night and since then I haven't had a failure. I'm going to continue to monitor, but in all honesty that's not a bad solution.

dark2phoenix commented 4 months ago

It's definitely related to using the GPU. Last night I was gaming much later than usual and crossed into the time period where I set tdarr node to run and all the converted files had errors.

Is this expected behavior? I thought the channels used by tdarr were independent than those used of video games.

dark2phoenix commented 3 months ago

Well, had 1 incident last night of about 25 files that were converted. It's set to requeue now though, so well see how it goes. Means it is not 100% tried to using the GPU as it was hours after I stopped actively using the computer and in the middle of other successful files.

HaveAGitGat commented 3 months ago

Should be separate but could be that the game is for some reason using the video encoder for something or also could be Window/Nvidia game tools which record the last 30 seconds of gameplay or whatever so you can make clips to share with friends.

dark2phoenix commented 3 months ago

Hmm....

Very good point. I have a tool that snaps 30 second videos when I get a kill or we win. I bet that may be what's doing it. Of course, it doesn't have any documentation that tells me what it uses, but I supposed it could be smart enough to want to use the video encoder at the same time.

That's something I think I can test out.

Thank you for the lead!

On Wed, Feb 28, 2024 at 7:38 PM HaveAGitGat @.***> wrote:

Should be separate but could be that the game is for some reason using the video encoder for something or also could be Window/Nvidia game tools which record the last 30 seconds of gameplay or whatever so you can make clips to share with friends.

— Reply to this email directly, view it on GitHub https://github.com/HaveAGitGat/Tdarr/issues/957#issuecomment-1970170175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARWYENKDF5IYVGAEL6PHITYVZ4ALAVCNFSM6AAAAABCND3XICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQGE3TAMJXGU . You are receiving this because you authored the thread.Message ID: @.***>