DNA
DNA4mo ago

Setting Deno.Command priority and affinity (on windows)

Is it possible to set a tasks / commands priority and affinity directly? Code:
await new Deno.Command("ffmpeg", {args: ["-i", filename, `${folder}/frame%08d.png`, "-threads", "1"]}).output();
await new Deno.Command("ffmpeg", {args: ["-i", filename, `${folder}/frame%08d.png`, "-threads", "1"]}).output();
No description
No description
No description
2 Replies
Deno AI Helper
Deno AI Helper4mo ago
I wasn't able to find the answer to your question in the official Deno documentation regarding setting a task's or command's priority and affinity directly in Deno. Looking at the code snippet you provided, I don't see any obvious syntax errors or mistakes. However, I would like to point out that the Deno.Command API does not have built-in options for setting process priority or CPU affinity. These features are specific to the operating system, and as of my knowledge cutoff date, Deno does not expose these capabilities directly. The advice provided here is not based on the Deno documentation, and I recommend double-checking the accuracy of this advice and exploring other resources or the Deno community for potential workarounds or solutions.
pyrote
pyrote4mo ago
You can use the windows "start" cmd to set priority and affinity. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/start cmd /c start "" /high /affinity 3 "ffmpeg.exe" (args go here) The affinity is a Hex number representing a bitmask for the CPU cores. Right most bit is the first CPU core. So 3 is CPU core 0 and 1. F would be cores 0,1,2,3.
start
Reference article for the start command, which starts a separate Command Prompt window to run a specified program or command.