如何限制FFMpeg CPU使用率? [英] How can I limit FFMpeg CPU usage?
问题描述
我试图将Process.PriorityClass设置为PriorityClass.BelowNormal,但这完全阻止了ffmpeg进程。
我确定有一种方法可以做到这一点,因为我看到很多使用ffmpeg的程序。
请帮忙。
您不能将FFMpeg限制在CPU使用率的百分比上,但您可以设置线程
参数,如果您有4个内核尝试将其设置为 -threads 2
,那应该将您限制在大约50%的CPU。 / p>
另一个解决方案可能是将FFMpeg进程的优先级降低到比应用程序低的程度。
I am calling FFMpeg inside a C# Windows Forms application. Since it uses so much CPU (always above 90%), none of my threads can continue working. Is there a way to limit this CPU usage?
I've tried to set Process.PriorityClass to PriorityClass.BelowNormal but this totally blocked the ffmpeg process.
I am sure there is a way to do this since I see a lot of programs that utilize ffmpeg.
Please help.
You can't limit FFMpeg to a percentage of CPU use, but you can set the -threads
parameter on your FFMpeg call, if you have 4 cores try set it to -threads 2
that should limit you to around 50% CPU.
Another solution might be to lower the priority on your FFMpeg process, to something lower than your applications.
这篇关于如何限制FFMpeg CPU使用率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!