mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-08-07 09:01:36 -04:00
Add fallback for keyframe-only trickplay extraction
Keyframe-only trickplay image extraction can fail for some media files. The current behavior is to skip the media file and try again on the next run, which will fail again. This adds a fallback to regular non-keyframe-only extraction for failed runs, so the extraction can complete.
This commit is contained in:
parent
982e0c9370
commit
bf3f37e3d0
@ -827,7 +827,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<string> ExtractVideoImagesOnIntervalAccelerated(
|
public async Task<string> ExtractVideoImagesOnIntervalAccelerated(
|
||||||
string inputFile,
|
string inputFile,
|
||||||
string container,
|
string container,
|
||||||
MediaSourceInfo mediaSource,
|
MediaSourceInfo mediaSource,
|
||||||
@ -918,18 +918,34 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
inputArg = "-hwaccel_flags +low_priority " + inputArg;
|
inputArg = "-hwaccel_flags +low_priority " + inputArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableKeyFrameOnlyExtraction)
|
|
||||||
{
|
|
||||||
inputArg = "-skip_frame nokey " + inputArg;
|
|
||||||
}
|
|
||||||
|
|
||||||
var filterParam = encodingHelper.GetVideoProcessingFilterParam(jobState, options, vidEncoder).Trim();
|
var filterParam = encodingHelper.GetVideoProcessingFilterParam(jobState, options, vidEncoder).Trim();
|
||||||
if (string.IsNullOrWhiteSpace(filterParam))
|
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, vidEncoder, threads, qualityScale, priority, cancellationToken);
|
try
|
||||||
|
{
|
||||||
|
return await ExtractVideoImagesOnIntervalInternal(
|
||||||
|
(enableKeyFrameOnlyExtraction ? "-skip_frame nokey " : string.Empty) + inputArg,
|
||||||
|
filterParam,
|
||||||
|
vidEncoder,
|
||||||
|
threads,
|
||||||
|
qualityScale,
|
||||||
|
priority,
|
||||||
|
cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (FfmpegException ex)
|
||||||
|
{
|
||||||
|
if (!enableKeyFrameOnlyExtraction)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogWarning(ex, "I-frame trickplay extraction failed, will attempt standard way. Input: {InputFile}", inputFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await ExtractVideoImagesOnIntervalInternal(inputArg, filterParam, vidEncoder, threads, qualityScale, priority, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string> ExtractVideoImagesOnIntervalInternal(
|
private async Task<string> ExtractVideoImagesOnIntervalInternal(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user