aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.MediaEncoding')
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs21
-rw-r--r--MediaBrowser.MediaEncoding/Transcoding/TranscodeManager.cs19
2 files changed, 29 insertions, 11 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
index 6549125d3..6579f1abe 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs
@@ -146,17 +146,18 @@ namespace MediaBrowser.MediaEncoding.Encoder
{ 5, new string[] { "overlay_vulkan", "Action to take when encountering EOF from secondary input" } }
};
- // These are the library versions that corresponds to our minimum ffmpeg version 4.x according to the version table below
+ // These are the library versions that corresponds to our minimum ffmpeg version 4.4 according to the version table below
+ // Refers to the versions in https://ffmpeg.org/download.html
private static readonly Dictionary<string, Version> _ffmpegMinimumLibraryVersions = new Dictionary<string, Version>
{
- { "libavutil", new Version(56, 14) },
- { "libavcodec", new Version(58, 18) },
- { "libavformat", new Version(58, 12) },
- { "libavdevice", new Version(58, 3) },
- { "libavfilter", new Version(7, 16) },
- { "libswscale", new Version(5, 1) },
- { "libswresample", new Version(3, 1) },
- { "libpostproc", new Version(55, 1) }
+ { "libavutil", new Version(56, 70) },
+ { "libavcodec", new Version(58, 134) },
+ { "libavformat", new Version(58, 76) },
+ { "libavdevice", new Version(58, 13) },
+ { "libavfilter", new Version(7, 110) },
+ { "libswscale", new Version(5, 9) },
+ { "libswresample", new Version(3, 9) },
+ { "libpostproc", new Version(55, 9) }
};
private readonly ILogger _logger;
@@ -176,7 +177,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
// When changing this, also change the minimum library versions in _ffmpegMinimumLibraryVersions
- public static Version MinVersion { get; } = new Version(4, 0);
+ public static Version MinVersion { get; } = new Version(4, 4);
public static Version? MaxVersion { get; } = null;
diff --git a/MediaBrowser.MediaEncoding/Transcoding/TranscodeManager.cs b/MediaBrowser.MediaEncoding/Transcoding/TranscodeManager.cs
index 5d51a901a..a07a0f41b 100644
--- a/MediaBrowser.MediaEncoding/Transcoding/TranscodeManager.cs
+++ b/MediaBrowser.MediaEncoding/Transcoding/TranscodeManager.cs
@@ -321,7 +321,7 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
}
catch (IOException ex)
{
- (exs ??= new List<Exception>(4)).Add(ex);
+ (exs ??= new List<Exception>()).Add(ex);
_logger.LogError(ex, "Error deleting HLS file {Path}", file);
}
}
@@ -546,6 +546,7 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
if (!transcodingJob.HasExited)
{
StartThrottler(state, transcodingJob);
+ StartSegmentCleaner(state, transcodingJob);
}
else if (transcodingJob.ExitCode != 0)
{
@@ -573,6 +574,22 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
&& state.IsInputVideo
&& state.VideoType == VideoType.VideoFile;
+ private void StartSegmentCleaner(StreamState state, TranscodingJob transcodingJob)
+ {
+ if (EnableSegmentCleaning(state))
+ {
+ transcodingJob.TranscodingSegmentCleaner = new TranscodingSegmentCleaner(transcodingJob, _loggerFactory.CreateLogger<TranscodingSegmentCleaner>(), _serverConfigurationManager, _fileSystem, _mediaEncoder, state.SegmentLength);
+ transcodingJob.TranscodingSegmentCleaner.Start();
+ }
+ }
+
+ private static bool EnableSegmentCleaning(StreamState state)
+ => state.InputProtocol is MediaProtocol.File or MediaProtocol.Http
+ && state.IsInputVideo
+ && state.TranscodingType == TranscodingJobType.Hls
+ && state.RunTimeTicks.HasValue
+ && state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks;
+
private TranscodingJob OnTranscodeBeginning(
string path,
string? playSessionId,