HaveAGitGat / Tdarr

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

Flows: Wait for available hardware encoder #884

Closed Foowy closed 11 months ago

Foowy commented 11 months ago

Is your feature request related to a problem? Please describe. When running a flow, if a node does not have supported encoder hardware, the flow still proceeds to attempt encode which will always lead to a failed flow.

Using "Check Node Hardware Encoder" causes flow to fail as well. It corrected the encoder issue, but the node that did not have NVENC encoder goes to a failed flow state anyways.

Example:

3 nodes in cluster. Two(2) support NVENC, One(1) is 7th Gen intel I5 with QSV support - Using VAAPI as generation of cpu/gpu does not support h265

If QSV system reaches encode stage, it will fail the flow. Regardless of hardware check or just continuing onto encode process.

Describe the solution you'd like Would like a possible end flow step that can be used to tell task to wait for available hardware. This was handled as intended with the classic stack, but not by flow process.

Describe alternatives you've considered Option 1 - Some form of error/validity check in the encode process to disallow a non supported node from completing task Option 2 - A flow return that waits for another node capable of handling task to become available Option 3 - Allow a flow path for Check Node Hardware Encoder when "2: Node does not have hardware" is chosen

Additional context

Log snippet from failed QSV -

2023-10-13T13:47:33.390Z NUMBER_OF_BYTES-eng: 3780106840 2023-10-13T13:47:33.390Z _STATISTICS_WRITING_APP-eng: mkvmerge v25.0.0 ('Prog Noir') 64-bit 2023-10-13T13:47:33.390Z _STATISTICS_WRITING_DATE_UTC-eng: 2018-10-05 16:05:14 2023-10-13T13:47:33.390Z _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES 2023-10-13T13:47:33.390Z DURATION : 02:13:21.065000000 2023-10-13T13:47:33.390Z [AVHWDeviceContext @ 0x55651bc877c0] Cannot load libcuda.so.1 2023-10-13T13:47:33.390Z [AVHWDeviceContext @ 0x55651bc877c0] Could not dynamically load CUDA 2023-10-13T13:47:33.390Z Device creation failed: -1. 2023-10-13T13:47:33.390Z [h264 @ 0x55651bc52d80] No device available for decoder: device type cuda needed for codec h264. 2023-10-13T13:47:33.390Z Stream mapping: 2023-10-13T13:47:33.390Z Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_nvenc)) 2023-10-13T13:47:33.390Z Stream #0:1 -> #0:1 (copy) 2023-10-13T13:47:33.390Z Stream #0:2 -> #0:2 (copy) 2023-10-13T13:47:33.390Z Device setup failed for decoder on input stream #0:0 : Operation not permitted

raysv commented 11 months ago

When using flows i'm getting this pretty often even if the encoder myself aswell:

2023-10-13T13:47:33.390Z Device setup failed for decoder on input stream #0:0 : Operation not permitted

Re'queing the item x number of times (not ideal), and suddenly it works. :)

HaveAGitGat commented 11 months ago

Could do something like this:

image

So will loop until encoding becomes possible.

Reopen on https://github.com/HaveAGitGat/Tdarr_Plugins if still having trouble.