如何使手刹使用cpu强度较小?
How to make handbrake use the cpu with less intensity?
我最近开始使用 HandBrake 来处理我下载的一些视频,使它们更轻便。我构建了一个小型 python GUI 程序来自动处理,利用 CLI 版本。我所做的是根据视频生成命令并使用 os.system 执行它。像这样:
import os
def process(args):
#some algorithm to generate cmd using args
cmd = "handbrakecli -i raw_video.mp4 -o video.mp4 -O -e x264" #example command
os.system(cmd)
os.remove("raw_video.mp4")
代码运行完美,但问题是我的 CPU 过度使用了。通常,这会在相当长的时间内占用 CPU 的 100% 使用率。我使用程序 CoreTemp 来跟踪我的处理器温度,通常它会达到 78 °C。
我尝试使用 BES(Battle Encoder Shirase)将 cmd 命令保存到名为 exec.bat 的批处理文件中并执行 os.system("BES_1.7.7\BES.exe -J -m exec.exe 20")
,但这根本没有任何作用。
速度根本不重要。即使需要更长的时间,我只是想少用我的 CPU,50% 左右就很好了。知道我该怎么做吗?
在 Handbrake 中,您可以传递高级参数,因此您只使用一定数量的 CPU 线程。
您可以使用threads
,查看Handbrake CLI Documentation
使用 threads
时,您可以指定要使用的任意数量的 CPU 处理器。默认值为 auto
.
-x
参数代表 Handbrake GUI 中的高级设置,这就是 threads
的位置。
下面告诉 Handbrake 只使用一个 CPU 线程进行高级设置:
-x threads=1
您还可以将 veryslow
用于 --encoder-preset
设置以帮助 CPU 加载。
--encoder-preset=veryslow
我实际上更喜欢使用 --encoder-preset=veryslow
预设,因为我发现编码的整体质量更好。
两者一起:
--encoder-preset=veryslow -x threads=1
使用您的 cmd
变量格式化:
cmd = "handbrakecli -i raw_video.mp4 -o video.mp4 -O -e x264 --encoder-preset=veryslow -x threads=1" #example command
看看是否有帮助。
我最近开始使用 HandBrake 来处理我下载的一些视频,使它们更轻便。我构建了一个小型 python GUI 程序来自动处理,利用 CLI 版本。我所做的是根据视频生成命令并使用 os.system 执行它。像这样:
import os
def process(args):
#some algorithm to generate cmd using args
cmd = "handbrakecli -i raw_video.mp4 -o video.mp4 -O -e x264" #example command
os.system(cmd)
os.remove("raw_video.mp4")
代码运行完美,但问题是我的 CPU 过度使用了。通常,这会在相当长的时间内占用 CPU 的 100% 使用率。我使用程序 CoreTemp 来跟踪我的处理器温度,通常它会达到 78 °C。
我尝试使用 BES(Battle Encoder Shirase)将 cmd 命令保存到名为 exec.bat 的批处理文件中并执行 os.system("BES_1.7.7\BES.exe -J -m exec.exe 20")
,但这根本没有任何作用。
速度根本不重要。即使需要更长的时间,我只是想少用我的 CPU,50% 左右就很好了。知道我该怎么做吗?
在 Handbrake 中,您可以传递高级参数,因此您只使用一定数量的 CPU 线程。
您可以使用threads
,查看Handbrake CLI Documentation
使用 threads
时,您可以指定要使用的任意数量的 CPU 处理器。默认值为 auto
.
-x
参数代表 Handbrake GUI 中的高级设置,这就是 threads
的位置。
下面告诉 Handbrake 只使用一个 CPU 线程进行高级设置:
-x threads=1
您还可以将 veryslow
用于 --encoder-preset
设置以帮助 CPU 加载。
--encoder-preset=veryslow
我实际上更喜欢使用 --encoder-preset=veryslow
预设,因为我发现编码的整体质量更好。
两者一起:
--encoder-preset=veryslow -x threads=1
使用您的 cmd
变量格式化:
cmd = "handbrakecli -i raw_video.mp4 -o video.mp4 -O -e x264 --encoder-preset=veryslow -x threads=1" #example command
看看是否有帮助。