我在命令提示符下以低优先级运行FFmpeg。
start /low /b ffmpeg -i "C:\video.mpg" -c:v libx264 -crf 25 "C:\video.mp4"
Run Code Online (Sandbox Code Playgroud)
如何在 PowerShell 中设置 FFmpeg 的优先级low, below normal, normal, above normal, high?
在 PowerShell 中使用上面的 CMD 命令,出现错误:
Parameter cannot be processed because the parameter name 'i' is ambiguous.
Start-Process : A positional parameter cannot be found that accepts argument 'ffmpeg'.
Run Code Online (Sandbox Code Playgroud)
测试解决方案
我正在尝试使用 ArcSet 答案中的第一个示例。
Start-Process ffmpeg -NoNewWindow -Wait -ArgumentList '-i "C:\video.mpg" -c:v libx264 -crf 25 "C:\video.mp4"' -PassThru Set-ProcessPriority -ProcessId $Process.id -Priority AboveNormal
Run Code Online (Sandbox Code Playgroud)
我收到错误:
A positional parameter cannot be found that accepts argument 'Set-ProcessPriority'
Run Code Online (Sandbox Code Playgroud)
使用以太集进程优先级
$Process = Start-Process "C:\ffmpeg\bin\ffmpeg.exe" -ArgumentList "-i `"C:\ffmpeg\Test\Test.mpg`" -c:v libx264 -crf 25 `"C:\ffmpeg\Test\Test.mp4`"" -PassThru
Set-ProcessPriority -ProcessId $Process.id -Priority BelowNormal
Run Code Online (Sandbox Code Playgroud)
或者在进程的属性中设置它
($Process = Start-Process "C:\ffmpeg\bin\ffmpeg.exe" -ArgumentList "-i `"C:\ffmpeg\Test\Test.mpg`" -c:v libx264 -crf 25 `"C:\ffmpeg\Test\Test.mp4`"" -NoNewWindow -PassThru).PriorityClass = [System.Diagnostics.ProcessPriorityClass]::BelowNormal
Run Code Online (Sandbox Code Playgroud)
如果您需要验证其设置为您请求的优先级,您可以调用存储过程的变量并检查
$Process.PriorityClass
Run Code Online (Sandbox Code Playgroud)
作为旁注,您将看到使用了 char `。这是一个转义字符,用于在引号内使用引号
"Hey `"There`" People"
Run Code Online (Sandbox Code Playgroud)
那会返回
Hey "There" People
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4782 次 |
| 最近记录: |