Move fps filter to GetVideoProcessingFilterParam
This commit is contained in:
parent
b89bf5d735
commit
dd8ef08592
|
@ -4806,6 +4806,15 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
subFilters?.RemoveAll(filter => string.IsNullOrEmpty(filter));
|
subFilters?.RemoveAll(filter => string.IsNullOrEmpty(filter));
|
||||||
overlayFilters?.RemoveAll(filter => string.IsNullOrEmpty(filter));
|
overlayFilters?.RemoveAll(filter => string.IsNullOrEmpty(filter));
|
||||||
|
|
||||||
|
var framerate = GetFramerateParam(state);
|
||||||
|
if (framerate.HasValue)
|
||||||
|
{
|
||||||
|
mainFilters.Insert(0, string.Format(
|
||||||
|
CultureInfo.InvariantCulture,
|
||||||
|
"fps={0}",
|
||||||
|
framerate.Value));
|
||||||
|
}
|
||||||
|
|
||||||
var mainStr = string.Empty;
|
var mainStr = string.Empty;
|
||||||
if (mainFilters?.Count > 0)
|
if (mainFilters?.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -804,7 +804,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
options.EnableTonemapping = false;
|
options.EnableTonemapping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var baseRequest = new BaseEncodingJobOptions { MaxWidth = maxWidth };
|
var baseRequest = new BaseEncodingJobOptions { MaxWidth = maxWidth, MaxFramerate = (float)(1.0 / interval.TotalSeconds) };
|
||||||
var jobState = new EncodingJobInfo(TranscodingJobType.Progressive)
|
var jobState = new EncodingJobInfo(TranscodingJobType.Progressive)
|
||||||
{
|
{
|
||||||
IsVideoRequest = true, // must be true for InputVideoHwaccelArgs to return non-empty value
|
IsVideoRequest = true, // must be true for InputVideoHwaccelArgs to return non-empty value
|
||||||
|
@ -829,18 +829,17 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
}
|
}
|
||||||
|
|
||||||
var filterParam = encodingHelper.GetVideoProcessingFilterParam(jobState, options, jobState.OutputVideoCodec).Trim();
|
var filterParam = encodingHelper.GetVideoProcessingFilterParam(jobState, options, jobState.OutputVideoCodec).Trim();
|
||||||
if (string.IsNullOrWhiteSpace(filterParam) || filterParam.IndexOf("\"", StringComparison.Ordinal) == -1)
|
if (string.IsNullOrWhiteSpace(filterParam))
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("EncodingHelper returned empty or invalid filter parameters.");
|
throw new InvalidOperationException("EncodingHelper returned empty or invalid filter parameters.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ExtractVideoImagesOnIntervalInternal(inputArg, filterParam, interval, vidEncoder, threads, qualityScale, priority, cancellationToken);
|
return ExtractVideoImagesOnIntervalInternal(inputArg, filterParam, vidEncoder, threads, qualityScale, priority, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string> ExtractVideoImagesOnIntervalInternal(
|
private async Task<string> ExtractVideoImagesOnIntervalInternal(
|
||||||
string inputArg,
|
string inputArg,
|
||||||
string filterParam,
|
string filterParam,
|
||||||
TimeSpan interval,
|
|
||||||
string vidEncoder,
|
string vidEncoder,
|
||||||
int? outputThreads,
|
int? outputThreads,
|
||||||
int? qualityScale,
|
int? qualityScale,
|
||||||
|
@ -853,16 +852,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output arguments
|
// Output arguments
|
||||||
string fps = "fps=1/" + interval.TotalSeconds.ToString(CultureInfo.InvariantCulture);
|
|
||||||
if (string.IsNullOrWhiteSpace(filterParam))
|
|
||||||
{
|
|
||||||
filterParam = "-vf \"" + fps + "\"";
|
|
||||||
}
|
|
||||||
else if (filterParam.IndexOf("\"", StringComparison.Ordinal) != -1)
|
|
||||||
{
|
|
||||||
filterParam = filterParam.Insert(filterParam.IndexOf("\"", StringComparison.Ordinal) + 1, fps + ",");
|
|
||||||
}
|
|
||||||
|
|
||||||
var targetDirectory = Path.Combine(_configurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N"));
|
var targetDirectory = Path.Combine(_configurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N"));
|
||||||
Directory.CreateDirectory(targetDirectory);
|
Directory.CreateDirectory(targetDirectory);
|
||||||
var outputPath = Path.Combine(targetDirectory, "%08d.jpg");
|
var outputPath = Path.Combine(targetDirectory, "%08d.jpg");
|
||||||
|
@ -895,7 +884,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
};
|
};
|
||||||
|
|
||||||
var processDescription = string.Format(CultureInfo.InvariantCulture, "{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
var processDescription = string.Format(CultureInfo.InvariantCulture, "{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
_logger.LogDebug("{ProcessDescription}", processDescription);
|
_logger.LogInformation("Trickplay generation: {ProcessDescription}", processDescription);
|
||||||
|
|
||||||
using (var processWrapper = new ProcessWrapper(process, this))
|
using (var processWrapper = new ProcessWrapper(process, this))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user