Add parameters for ffmpeg options
This commit is contained in:
parent
5616c763d6
commit
822bd31c8f
@ -1,3 +1,4 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
using MediaBrowser.Model.Plugins;
|
using MediaBrowser.Model.Plugins;
|
||||||
|
|
||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
|
||||||
@ -181,4 +182,14 @@ public class PluginConfiguration : BasePluginConfiguration
|
|||||||
/// Gets or sets the notification text sent after automatically skipping an introduction.
|
/// Gets or sets the notification text sent after automatically skipping an introduction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AutoSkipNotificationText { get; set; } = "Intro skipped";
|
public string AutoSkipNotificationText { get; set; } = "Intro skipped";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the number of threads for an ffmpeg process.
|
||||||
|
/// </summary>
|
||||||
|
public int ProcessThreads { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the relative priority for an ffmpeg process.
|
||||||
|
/// </summary>
|
||||||
|
public ProcessPriorityClass ProcessPriority { get; set; } = ProcessPriorityClass.BelowNormal;
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RootNamespace>ConfusedPolarBear.Plugin.IntroSkipper</RootNamespace>
|
<RootNamespace>ConfusedPolarBear.Plugin.IntroSkipper</RootNamespace>
|
||||||
<AssemblyVersion>0.1.14.0</AssemblyVersion>
|
<AssemblyVersion>0.1.15.0</AssemblyVersion>
|
||||||
<FileVersion>0.1.14.0</FileVersion>
|
<FileVersion>0.1.15.0</FileVersion>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
@ -400,8 +400,9 @@ public static class FFmpegWrapper
|
|||||||
// for each file that is fingerprinted.
|
// for each file that is fingerprinted.
|
||||||
var prependArgument = string.Format(
|
var prependArgument = string.Format(
|
||||||
CultureInfo.InvariantCulture,
|
CultureInfo.InvariantCulture,
|
||||||
"-hide_banner -loglevel {0} ",
|
"-hide_banner -loglevel {0} -threads {1} ",
|
||||||
logLevel);
|
logLevel,
|
||||||
|
Plugin.Instance?.Configuration.ProcessThreads ?? 0);
|
||||||
|
|
||||||
var info = new ProcessStartInfo(ffmpegPath, args.Insert(0, prependArgument))
|
var info = new ProcessStartInfo(ffmpegPath, args.Insert(0, prependArgument))
|
||||||
{
|
{
|
||||||
@ -425,6 +426,17 @@ public static class FFmpegWrapper
|
|||||||
|
|
||||||
ffmpeg.Start();
|
ffmpeg.Start();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ffmpeg.PriorityClass = Plugin.Instance?.Configuration.ProcessPriority ?? ProcessPriorityClass.BelowNormal;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger?.LogDebug(
|
||||||
|
"ffmpeg priority could not be modified. {Message}",
|
||||||
|
e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
using (MemoryStream ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
var buf = new byte[4096];
|
var buf = new byte[4096];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user