–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
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。