diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 3cc04333a..3bef397f9 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -263,38 +263,27 @@ namespace MediaBrowser.Api.Playback
return returnFirstIfNoIndex ? streams.FirstOrDefault() : null;
}
- protected EncodingQuality GetQualitySetting()
- {
- var quality = ApiEntryPoint.Instance.GetEncodingOptions().EncodingQuality;
-
- if (quality == EncodingQuality.Auto)
- {
- var cpuCount = Environment.ProcessorCount;
-
- if (cpuCount >= 4)
- {
- //return EncodingQuality.HighQuality;
- }
-
- return EncodingQuality.HighSpeed;
- }
-
- return quality;
- }
-
///
/// Gets the number of threads.
///
/// System.Int32.
protected int GetNumberOfThreads(StreamState state, bool isWebm)
{
+ var threads = ApiEntryPoint.Instance.GetEncodingOptions().EncodingThreadCount;
+
if (isWebm)
{
// Recommended per docs
return Math.Max(Environment.ProcessorCount - 1, 2);
}
- return 0;
+ // Automatic
+ if (threads == -1)
+ {
+ return 0;
+ }
+
+ return threads;
}
protected string H264Encoder
@@ -326,77 +315,31 @@ namespace MediaBrowser.Api.Playback
var isVc1 = state.VideoStream != null &&
string.Equals(state.VideoStream.Codec, "vc1", StringComparison.OrdinalIgnoreCase);
- var qualitySetting = GetQualitySetting();
-
if (string.Equals(videoCodec, "libx264", StringComparison.OrdinalIgnoreCase))
{
param = "-preset superfast";
- switch (qualitySetting)
- {
- case EncodingQuality.HighSpeed:
- param += " -crf 23";
- break;
- case EncodingQuality.HighQuality:
- param += " -crf 20";
- break;
- case EncodingQuality.MaxQuality:
- param += " -crf 18";
- break;
- }
+ param += " -crf 23";
}
else if (string.Equals(videoCodec, "libx265", StringComparison.OrdinalIgnoreCase))
{
param = "-preset fast";
- switch (qualitySetting)
- {
- case EncodingQuality.HighSpeed:
- param += " -crf 28";
- break;
- case EncodingQuality.HighQuality:
- param += " -crf 25";
- break;
- case EncodingQuality.MaxQuality:
- param += " -crf 21";
- break;
- }
+ param += " -crf 28";
}
// h264 (h264_qsv)
else if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
{
- switch (qualitySetting)
- {
- case EncodingQuality.HighSpeed:
- param = "-preset 7";
- break;
- case EncodingQuality.HighQuality:
- param = "-preset 4";
- break;
- case EncodingQuality.MaxQuality:
- param = "-preset 1";
- break;
- }
+ param = "-preset 7";
}
// h264 (libnvenc)
else if (string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
{
- switch (qualitySetting)
- {
- case EncodingQuality.HighSpeed:
- param = "-preset high-performance";
- break;
- case EncodingQuality.HighQuality:
- param = "";
- break;
- case EncodingQuality.MaxQuality:
- param = "-preset high-quality";
- break;
- }
+ param = "-preset high-performance";
}
// webm
@@ -409,20 +352,7 @@ namespace MediaBrowser.Api.Playback
var qmin = "0";
var qmax = "50";
- switch (qualitySetting)
- {
- case EncodingQuality.HighSpeed:
- crf = "10";
- break;
- case EncodingQuality.HighQuality:
- crf = "6";
- break;
- case EncodingQuality.MaxQuality:
- crf = "4";
- break;
- default:
- throw new ArgumentException("Unrecognized quality setting");
- }
+ crf = "10";
if (isVc1)
{
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
index 9153045e6..140e84963 100644
--- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
@@ -521,42 +521,18 @@ namespace MediaBrowser.MediaEncoding.Encoder
var isVc1 = state.VideoStream != null &&
string.Equals(state.VideoStream.Codec, "vc1", StringComparison.OrdinalIgnoreCase);
- var qualitySetting = state.Quality;
-
if (string.Equals(videoCodec, "libx264", StringComparison.OrdinalIgnoreCase))
{
param = "-preset superfast";
- switch (qualitySetting)
- {
- case EncodingQuality.HighSpeed:
- param += " -crf 28";
- break;
- case EncodingQuality.HighQuality:
- param += " -crf 25";
- break;
- case EncodingQuality.MaxQuality:
- param += " -crf 21";
- break;
- }
+ param += " -crf 28";
}
else if (string.Equals(videoCodec, "libx265", StringComparison.OrdinalIgnoreCase))
{
param = "-preset fast";
- switch (qualitySetting)
- {
- case EncodingQuality.HighSpeed:
- param += " -crf 28";
- break;
- case EncodingQuality.HighQuality:
- param += " -crf 25";
- break;
- case EncodingQuality.MaxQuality:
- param += " -crf 21";
- break;
- }
+ param += " -crf 28";
}
// webm
@@ -569,20 +545,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
var qmin = "0";
var qmax = "50";
- switch (qualitySetting)
- {
- case EncodingQuality.HighSpeed:
- crf = "10";
- break;
- case EncodingQuality.HighQuality:
- crf = "6";
- break;
- case EncodingQuality.MaxQuality:
- crf = "4";
- break;
- default:
- throw new ArgumentException("Unrecognized quality setting");
- }
+ crf = "10";
if (isVc1)
{
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
index bb32ac95b..2eeb580e3 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
@@ -25,7 +25,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
public Stream LogFileStream { get; set; }
public IProgress Progress { get; set; }
public TaskCompletionSource TaskCompletionSource;
- public EncodingQuality Quality { get; set; }
public EncodingJobOptions Options { get; set; }
public string InputContainer { get; set; }
public MediaSourceInfo MediaSource { get; set; }
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
index d56838c8b..476d9166b 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
@@ -96,10 +96,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
TryStreamCopy(state, request);
- state.Quality = options.Context == EncodingContext.Static ?
- EncodingQuality.MaxQuality :
- GetQualitySetting();
-
return state;
}
@@ -199,25 +195,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
state.MediaSource = mediaSource;
}
- protected EncodingQuality GetQualitySetting()
- {
- var quality = GetEncodingOptions().EncodingQuality;
-
- if (quality == EncodingQuality.Auto)
- {
- var cpuCount = Environment.ProcessorCount;
-
- if (cpuCount >= 4)
- {
- //return EncodingQuality.HighQuality;
- }
-
- return EncodingQuality.HighSpeed;
- }
-
- return quality;
- }
-
protected EncodingOptions GetEncodingOptions()
{
return _config.GetConfiguration("encoding");
diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
index 90a185a97..7d813e903 100644
--- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
+++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
@@ -203,9 +203,6 @@
Configuration\EncodingOptions.cs
-
- Configuration\EncodingQuality.cs
-
Configuration\FanartOptions.cs
diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
index e7878fb1b..8605a0ab3 100644
--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
@@ -168,9 +168,6 @@
Configuration\EncodingOptions.cs
-
- Configuration\EncodingQuality.cs
-
Configuration\FanartOptions.cs
diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs
index ae714a84e..6d3894f02 100644
--- a/MediaBrowser.Model/Configuration/EncodingOptions.cs
+++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs
@@ -3,7 +3,7 @@ namespace MediaBrowser.Model.Configuration
{
public class EncodingOptions
{
- public EncodingQuality EncodingQuality { get; set; }
+ public int EncodingThreadCount { get; set; }
public string TranscodingTempPath { get; set; }
public double DownMixAudioBoost { get; set; }
public string H264Encoder { get; set; }
@@ -15,9 +15,9 @@ namespace MediaBrowser.Model.Configuration
{
H264Encoder = "libx264";
DownMixAudioBoost = 2;
- EncodingQuality = EncodingQuality.Auto;
EnableThrottling = true;
ThrottleThresholdInSeconds = 120;
+ EncodingThreadCount = -1;
}
}
}
diff --git a/MediaBrowser.Model/Configuration/EncodingQuality.cs b/MediaBrowser.Model/Configuration/EncodingQuality.cs
deleted file mode 100644
index ba5a1f279..000000000
--- a/MediaBrowser.Model/Configuration/EncodingQuality.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace MediaBrowser.Model.Configuration
-{
- public enum EncodingQuality
- {
- Auto,
- HighSpeed,
- HighQuality,
- MaxQuality
- }
-}
\ No newline at end of file
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index 5c7caf407..19c5c833a 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -159,7 +159,6 @@
-
diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs
index f2f1663e4..0d4fc6720 100644
--- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs
+++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs
@@ -61,22 +61,22 @@ namespace MediaBrowser.Providers.MediaInfo
{
cancellationToken.ThrowIfCancellationRequested();
- var idString = item.Id.ToString("N");
- var cachePath = Path.Combine(_appPaths.CachePath,
- "ffprobe-audio",
- idString.Substring(0, 2), idString, "v" + SchemaVersion + _mediaEncoder.Version + item.DateModified.Ticks.ToString(_usCulture) + ".json");
+ //var idString = item.Id.ToString("N");
+ //var cachePath = Path.Combine(_appPaths.CachePath,
+ // "ffprobe-audio",
+ // idString.Substring(0, 2), idString, "v" + SchemaVersion + _mediaEncoder.Version + item.DateModified.Ticks.ToString(_usCulture) + ".json");
- try
- {
- return _json.DeserializeFromFile(cachePath);
- }
- catch (FileNotFoundException)
- {
+ //try
+ //{
+ // return _json.DeserializeFromFile(cachePath);
+ //}
+ //catch (FileNotFoundException)
+ //{
- }
- catch (DirectoryNotFoundException)
- {
- }
+ //}
+ //catch (DirectoryNotFoundException)
+ //{
+ //}
var result = await _mediaEncoder.GetMediaInfo(new MediaInfoRequest
{
@@ -86,8 +86,8 @@ namespace MediaBrowser.Providers.MediaInfo
}, cancellationToken).ConfigureAwait(false);
- Directory.CreateDirectory(Path.GetDirectoryName(cachePath));
- _json.SerializeToFile(result, cachePath);
+ //Directory.CreateDirectory(Path.GetDirectoryName(cachePath));
+ //_json.SerializeToFile(result, cachePath);
return result;
}