-
-
Save sbrown7792/855858a2a6ab812126dbb6580ae4418e to your computer and use it in GitHub Desktop.
@echo off | |
echo %* > D:\TDarr_1\Tdarr_Node\node_modules\@ffmpeg-installer\win32-x64\arg.txt | |
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "D:\TDarr_1\Tdarr_Node\node_modules\@ffmpeg-installer\win32-x64\ffmpeg_gpu1.ps1" |
$Logfile = "D:\TDarr_1\Tdarr_Node\PS.log" | |
Function LogWrite | |
{ | |
Param ([string]$logstring) | |
Add-content $Logfile -value $logstring | |
} | |
#get the saved arguments from the batch file | |
$desired_args = Get-Content "D:\TDarr_1\Tdarr_Node\node_modules\@ffmpeg-installer\win32-x64\arg.txt" -First 1 | |
LogWrite "Before: " | |
LogWrite $desired_args | |
#insert the -gpu 1 flag where it belongs. hopefully the 9999 argumenent will always be there.... | |
$desired_args = $desired_args -replace "-i", "-gpu 1 -i" | |
$desired_args = $desired_args -replace "9999", "9999 -gpu 1" | |
LogWrite "After: " | |
LogWrite $desired_args | |
#tdarr seems to execute ffmpeg when booting to make sure it works, so allow it to run without args | |
if ($desired_args -eq $null) { | |
& D:\TDarr_1\Tdarr_Node\node_modules\@ffmpeg-installer\win32-x64\ffmpeg_gpu1.exe | |
} else { | |
Start-Process D:\TDarr_1\Tdarr_Node\node_modules\@ffmpeg-installer\win32-x64\ffmpeg_gpu1.exe -NoNewWindow -ArgumentList $desired_args | |
} |
@sbrown7792, I think that this is roughly in the same ballpark that I'm dealing with... but I don't think I'm on this exact "issue" yet...
I'm using Unraid containers for both Server & Node. GPU P2000.
Setup secondary Win10 node with dual GPU's. I'm 95% sure that I have it configured correctly because I see the 2nd node on the GUI page.
The issue that I'm coming across is that it auto-rejects when I turn on a GPU to transcode.
[hevc_nvenc @ 000001e5812ff5c0] No NVENC capable devices found
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
I have a feeling that it has to do with what you're talking about, but I'm unsure on what/where I need to edit.
Appreciate any help you can give.
Thanks!
Hi @TechD87,
That's a different symptom/problem than I was running into - My Win10 node would at least start GPU transcoding on the first GPU - I never saw the message [hevc_nvenc @ 000001e5812ff5c0] No NVENC capable devices found
Just to make sure I understand your setup, you have:
- Unraid container as a TDarr server
- Unraid container as a TDarr node with a P2000
- Win10 node with two unique GPUs (not the same GPU as the Unraid-TDarr node-P2000 above, right?)
- Your TDarr server web interface shows two nodes, the Unraid node and the Win10 node
If all of the above is true, then it just sounds like your Win10 computer doesn't have a GPU or GPU driver capable of NVENC. Or maybe the first GPU - the GPU that TDarr defaults to - doesn't have the NVENC-capable driver, but the second one does. If the latter is the case, then yes, you could probably use this gist to make TDarr node use the second, NVENC-capable, GPU.
If both GPUs should support NVENC, then you may just have to get the right GPU driver. I don't think I had to do anything special for TDarr, but I have in the past installed special drivers for my GPUs for certain hardware acceleration tasks - can't remember what/when/etc, sorry.
@sbrown7792 Thanks for this, I've got it set up and the node can complete tasks.
Unfortunately it looks to be using GPU0. It looks like 9999 doesn't exist in the args. Any ideas please?
EDIT: Think I've sorted it. I've changed the replace from "9999" to "-map 0" > "-gpu 1 -map 0" and seems to be holding up :)
@BigManDave Sounds like you managed to figure it out before I had a chance to reply!
Perhaps an update to the node and/or server changed the arguments that are passed to ffmpeg. For anyone following, I believe this code was first written against server version 2.00.10
Looks like my comment hopefully the 9999 argumenent will always be there....
was a bit of foreshadowing ;)
Thank you for this nice workaround, it works as described here at my setup.
It has presented another slight issue that the decode process still runs on just one of the GPUs, and not on the GPU specified with the "-gpu 0" option... so now the decode GPU/Core seems to be the bottleneck :-)
Any idea if there is an option on ffmpeg.exe where you can specify on which GPU the decode process should run?
I figured it out with a bit of help from the Tdarr discord...
Everything before -i relates to input, and everything after -i relates to the output.
So I have updated the powershell script replace lines like this:
$desired_args = $desired_args -replace "-i", "-gpu 1 -i"
$desired_args = $desired_args -replace "9999", "9999 -gpu 1"
(maybe this can be done cleaner in one line, but it works for me know...)
@heinowalther Much thanks to you and the discord! I haven't tested it on my system yet, but once I do, I will update the gist accordingly :)
Would be great if you had a linux version of this. Thanks!
@heinowalther Finally got a chance to test this - worked perfectly! I updated the gist, thanks!
@simeononsecurity Unfortunately none of my linux servers have GPUs in them, so I don't use them for transcoding & wouldn't be able to test out anything. At a high-level though, the powershell could be replaced with a bash script, and something like "sed 's/9999/9999 -gpu 1/'" would do the argument insertion.
Hi there @sbrown7792
Running two nvidia card on one system (Windows 10 21H2) one RTX 3060 (GPU-0) and a Quadro P2000 (GPU-1) i tried your gist and get and find ffmpeg is still using gpu 0 (the RTX) when transcoding
here is my PS1
$Logfile = "C:\Tdarr_Updater-p2000\Tdarr_Node\PS.log"
Function LogWrite
{
Param ([string]$logstring)
Add-content $Logfile -value $logstring
}
#get the saved arguments from the batch file
$desired_args = Get-Content "C:\Tdarr_Updater-p2000\Tdarr_Node\node_modules@ffmpeg-installer\win32-x64\arg.txt" -First 1
LogWrite "Before: "
LogWrite $desired_args
#insert the -gpu 1 flag where it belongs. hopefully the 9999 argumenent will always be there....
$desired_args = $desired_args -replace "-i", "-gpu 1 -i"
$desired_args = $desired_args -replace "9999", "9999 -gpu 1"
LogWrite "After: "
LogWrite $desired_args
#tdarr seems to execute ffmpeg when booting to make sure it works, so allow it to run without args
if ($desired_args -eq $null) {
& C:\Tdarr_Updater-p2000\Tdarr_Node\node_modules@ffmpeg-installer\win32-x64\ffmpeg.exe
} else {
Start-Process C:\Tdarr_Updater-p2000\Tdarr_Node\node_modules@ffmpeg-installer\win32-x64\ffmpeg.exe -NoNewWindow -ArgumentList $desired_args
}
can someone help me with the .bat file. My arg.txt file only contains %* and I get [NULL @ 000001c42af49c40] Unable to find a suitable output format for 'ECHO'
ECHO: Invalid argument
can anyone help?
I couldn't get ffmpeg to actually pick up my second gpu a RTX A2000. I ended up replacing this:
#insert the -gpu 1 flag where it belongs. hopefully the 9999 argumenent will always be there....
$desired_args = $desired_args -replace "-i", "-gpu 1 -i"
$desired_args = $desired_args -replace "9999", "9999 -gpu 1"
with this:
$desired_args = $desired_args -replace "-v error", "-v error -hwaccel_device 1"
and it seems to work for me.
Well,
-hwaccel_device 1 doesn't work with encodes just decodes apparently.
@jbeck22 , @SQLServerIO , @CanonCan , and @anyone_else
Not sure if any of you are still having problems with this, but looks like TDarr officially got a new plugin which does the multi-GPU support natively. I haven't had a chance to check it out, but just wanted to bring it to your attention, should you still need it.
I'm still running custom scripts. I'll take a poke at it.
I want to try it out, but how do I add it to Tdarr? I know how to add community plugins already...just not sure which one this is listed under.
Assumes you have a copy of the ffmpeg executable renamed "ffmpeg_gpu1.exe". Doesn't have to be renamed, but it makes it easy to verify in Task Manager.
Make a copy of your working Tdarr_Node and configs folder, set "ffmpegPath": "D:\TDarr_1\Tdarr_Node\node_modules\@ffmpeg-installer\win32-x64\ffmpeg_gpu1.bat" in the copied Tdarr_Node_Config.json, and use a different nodeID and nodePort than the first instance of Tdarr.
Then, launch the second instance of Tdarr_Node.exe (the one in the copied folder) and cross your fingers.