如何限制FFMpeg CPU使用率? [英] How can I limit FFMpeg CPU usage?

查看:1847
本文介绍了如何限制FFMpeg CPU使用率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#Windows窗体应用程序中调用FFMpeg。因为它使用了这么多的CPU(总是高于90%),所以我的线程都不能继续工作。有没有办法限制这个CPU使用率?



我试图将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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆