The Free Software Media System - Server Backend & API
limit videos for keyframe extraction
Luke Pulverenti29caf70fee52
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.csindex 503399f8db..8eaf0a78eb 100644--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs@@ -7,6 +7,7 @@ using MediaBrowser.Controller.MediaEncoding;using MediaBrowser.Controller.Session;using MediaBrowser.MediaEncoding.Probing;using MediaBrowser.Model.Dlna;+using MediaBrowser.Model.Dto;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Extensions;using MediaBrowser.Model.IO;@@ -247,10 +248,7 @@ namespace MediaBrowser.MediaEncoding.Encoder{foreach (var stream in mediaInfo.MediaStreams){- if (stream.Type == MediaStreamType.Video &&- string.Equals(stream.Codec, "h264", StringComparison.OrdinalIgnoreCase) &&- !stream.IsInterlaced &&- !(stream.IsAnamorphic ?? false))+ if (EnableKeyframeExtraction(mediaInfo, stream)){try{@@ -287,6 +285,25 @@ namespace MediaBrowser.MediaEncoding.Encoderthrow new ApplicationException(string.Format("FFProbe failed for {0}", inputPath));}+ private bool EnableKeyframeExtraction(MediaSourceInfo mediaSource, MediaStream videoStream)+ {+ if (videoStream.Type == MediaStreamType.Video && string.Equals(videoStream.Codec, "h264", StringComparison.OrdinalIgnoreCase) &&+ !videoStream.IsInterlaced &&+ !(videoStream.IsAnamorphic ?? false))+ {+ var audioStreams = mediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio).ToList();++ // If it has aac audio then it will probably direct stream anyway, so don't bother with this+ if (audioStreams.Count == 1 && string.Equals(audioStreams[0].Codec, "aac", StringComparison.OrdinalIgnoreCase))+ {+ return false;+ }++ return true;+ }+ return false;+ }+private async Task<List<int>> GetKeyFrames(string inputPath, int videoStreamIndex, CancellationToken cancellationToken){inputPath = inputPath.Split(new[] { ':' }, 2).Last().Trim('"');@@ -313,7 +330,7 @@ namespace MediaBrowser.MediaEncoding.EncoderEnableRaisingEvents = true};- _logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);+ _logger.Info("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);using (process){@@ -339,7 +356,7 @@ namespace MediaBrowser.MediaEncoding.Encoderprocess.WaitForExit();- _logger.Debug("Keyframe extraction took {0} seconds", (DateTime.UtcNow - start).TotalSeconds);+ _logger.Info("Keyframe extraction took {0} seconds", (DateTime.UtcNow - start).TotalSeconds);//_logger.Debug("Found keyframes {0}", string.Join(",", lines.ToArray()));return lines;}diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csprojindex 552edf97ea..ac3437892c 100644--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj@@ -2649,6 +2649,9 @@<Content Include="dashboard-ui\strings\javascript\zh-TW.json"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>+ <None Include="dashboard-ui\strings\html\zh-HK.json">+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>+ </None><None Include="dashboard-ui\thirdparty\fontawesome\css\font-awesome.css.map"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></None>