我是靠谱客的博主 洁净胡萝卜,这篇文章主要介绍FFmpeg限制CPU的使用率,现在分享给大家,希望可以做个参考。

转自:http://www.ithao123.cn/content-6000916.html

 

–threads 2 参数

 

 使用–threads 2 可以将CPU的使用率控制在50%左右。

FFmpeg -i IN  –threads 2   OUT

 

源文链接:https://stackoverflow.com/questions/11357713/how-to-limit-ffmpeg-cpu-usage

The solution as outlined here

How can I limit FFMpeg CPU usage?

is to limit the number of threads that FFMpeg uses to less than the number of available cores on the computer.

Following up on your comment, you can supply an Argument via StartInfo

复制代码
1
2
3
Process ffmpeg = new Process(); ffmpeg.StartInfo.UseShellExecute = false; ffmpeg.StartInfo.FileName = "..ffmpeg.exe"; ffmpeg.StartInfo.Arguments = "-threads 2"; // <=== Add this line ffmpeg.StartInfo.CreateNoWindow = true; ffmpeg.Start();

测试一 -threads

-threads 2 以两个线程进行运行, 加快处理的速度。

 

 转换视频:7752c7dd-36aa-47eb-95a5-2193c9726541.wmv

目标视频:7752c7dd-36aa-47eb-95a5-2193c9726541.mp4

转换命令:FFmpeg -i IN -map 0 -r 25 -threads 4 -y Out

 

本机测试机环境:win7旗舰版+Intel(R) Core(TM)i5-2400 CPU @3.10GHz  3.10GHz+4.00GB+64bit

 

序号

开启的线程数

占用CPU数

CPU使用率(%)

转换时间(min)

其他

1

1

1

25

7

 

2

2

4

40-55

3

2个CPU〉50%,1个=50%,1个CPU=40%

3

4

4

60-70

3

4个CPU比较平均

4

4

4

70-80

2

4个CPU使用平均

5

-

4

80-85

2

4个CPU使用较平均

 

为了达到更快的转换速度,CPU使用率在可允许范围内,选择-threads 2。

最后

以上就是洁净胡萝卜最近收集整理的关于FFmpeg限制CPU的使用率的全部内容,更多相关FFmpeg限制CPU内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(76)

评论列表共有 0 条评论

立即
投稿
返回
顶部