From a7e31ef31f0202cefe1fd97a648260c3f4791446 Mon Sep 17 00:00:00 2001 From: Phallacy Date: Thu, 4 Apr 2019 23:04:54 -0700 Subject: applied changes to just also search jellyfin base dir --- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'MediaBrowser.MediaEncoding') diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 4867c0f85..b626600fa 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -230,6 +230,11 @@ namespace MediaBrowser.MediaEncoding.Encoder /// private string ExistsOnSystemPath(string filename) { + string inJellyfinPath = GetEncoderPathFromDirectory(System.AppContext.BaseDirectory, filename); + if (!string.IsNullOrEmpty(inJellyfinPath)) + { + return inJellyfinPath; + } var values = Environment.GetEnvironmentVariable("PATH"); foreach (var path in values.Split(Path.PathSeparator)) -- cgit v1.2.3 From 91cd7d2f6b3e9ce1212d9c29519aa2b23731b8e9 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Tue, 30 Apr 2019 23:35:39 +0200 Subject: Limit amount of ffmpeg processes extracting images at once --- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 37 +++++++++++++--------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'MediaBrowser.MediaEncoding') diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index b626600fa..a8874b6d0 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -53,7 +53,7 @@ namespace MediaBrowser.MediaEncoding.Encoder private readonly int DefaultImageExtractionTimeoutMs; private readonly string StartupOptionFFmpegPath; - private readonly SemaphoreSlim _thumbnailResourcePool = new SemaphoreSlim(1, 1); + private readonly SemaphoreSlim _thumbnailResourcePool = new SemaphoreSlim(2, 2); private readonly List _runningProcesses = new List(); private readonly ILocalizationManager _localization; @@ -582,19 +582,27 @@ namespace MediaBrowser.MediaEncoding.Encoder { bool ranToCompletion; - StartProcess(processWrapper); - - var timeoutMs = ConfigurationManager.Configuration.ImageExtractionTimeoutMs; - if (timeoutMs <= 0) + await _thumbnailResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false); + try { - timeoutMs = DefaultImageExtractionTimeoutMs; - } + StartProcess(processWrapper); + + var timeoutMs = ConfigurationManager.Configuration.ImageExtractionTimeoutMs; + if (timeoutMs <= 0) + { + timeoutMs = DefaultImageExtractionTimeoutMs; + } - ranToCompletion = await process.WaitForExitAsync(timeoutMs).ConfigureAwait(false); + ranToCompletion = await process.WaitForExitAsync(timeoutMs).ConfigureAwait(false); - if (!ranToCompletion) + if (!ranToCompletion) + { + StopProcess(processWrapper, 1000); + } + } + finally { - StopProcess(processWrapper, 1000); + _thumbnailResourcePool.Release(); } var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1; @@ -625,7 +633,8 @@ namespace MediaBrowser.MediaEncoding.Encoder return time.ToString(@"hh\:mm\:ss\.fff", UsCulture); } - public async Task ExtractVideoImagesOnInterval(string[] inputFiles, + public async Task ExtractVideoImagesOnInterval( + string[] inputFiles, string container, MediaStream videoStream, MediaProtocol protocol, @@ -636,8 +645,6 @@ namespace MediaBrowser.MediaEncoding.Encoder int? maxWidth, CancellationToken cancellationToken) { - var resourcePool = _thumbnailResourcePool; - var inputArgument = GetInputArgument(inputFiles, protocol); var vf = "fps=fps=1/" + interval.TotalSeconds.ToString(UsCulture); @@ -701,7 +708,7 @@ namespace MediaBrowser.MediaEncoding.Encoder _logger.LogInformation(process.StartInfo.FileName + " " + process.StartInfo.Arguments); - await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false); + await _thumbnailResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false); bool ranToCompletion = false; @@ -742,7 +749,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } finally { - resourcePool.Release(); + _thumbnailResourcePool.Release(); } var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1; -- cgit v1.2.3 From 5d85076ad5152b60ca2101177330b24944a65411 Mon Sep 17 00:00:00 2001 From: JMCC Date: Sat, 11 May 2019 17:17:32 +0200 Subject: Enable Exynos V4L2-m2m HW encoder --- MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'MediaBrowser.MediaEncoding') diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 3eed891cb..b00350875 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -207,6 +207,7 @@ namespace MediaBrowser.MediaEncoding.Encoder "hevc_omx", "h264_vaapi", "hevc_vaapi", + "h264_v4l2m2m", "ac3" }; -- cgit v1.2.3 From 5c1fbfca03a88eebb7ae4703c97d1d7896c93585 Mon Sep 17 00:00:00 2001 From: Tristan McCann Date: Tue, 11 Jun 2019 21:34:23 -0400 Subject: Stop path substitution in SubtitleEncoder This fixes jellyfin/jellyfin#1446. I am not an expert in this section of code, but I cannot think of a need to do path substitution during subtitle encoding. --- MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'MediaBrowser.MediaEncoding') diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index d978359c7..8677b363f 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -126,8 +126,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles throw new ArgumentNullException(nameof(mediaSourceId)); } - // TODO network path substition useful ? - var mediaSources = await _mediaSourceManager.GetPlayackMediaSources(item, null, true, true, cancellationToken).ConfigureAwait(false); + var mediaSources = await _mediaSourceManager.GetPlayackMediaSources(item, null, true, false, cancellationToken).ConfigureAwait(false); var mediaSource = mediaSources .First(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase)); -- cgit v1.2.3 From 555459525515edf9f506465cefce0c6a6aca326d Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Fri, 14 Jun 2019 18:49:57 +0200 Subject: Update deps --- Emby.Naming/Emby.Naming.csproj | 2 +- .../Emby.Server.Implementations.csproj | 7 +++---- Jellyfin.Server/Jellyfin.Server.csproj | 14 +++++++------- .../MediaBrowser.MediaEncoding.csproj | 2 +- MediaBrowser.Providers/MediaBrowser.Providers.csproj | 2 +- jellyfin.ruleset | 4 ++++ 6 files changed, 17 insertions(+), 14 deletions(-) (limited to 'MediaBrowser.MediaEncoding') diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj index 6e05eb795..9e2a4950f 100644 --- a/Emby.Naming/Emby.Naming.csproj +++ b/Emby.Naming/Emby.Naming.csproj @@ -23,7 +23,7 @@ - + diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index d4e17c42a..49015a07e 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -31,10 +31,9 @@ - - + + - @@ -52,7 +51,7 @@ - + diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj index 81f145abf..641b3f182 100644 --- a/Jellyfin.Server/Jellyfin.Server.csproj +++ b/Jellyfin.Server/Jellyfin.Server.csproj @@ -26,7 +26,7 @@ - + @@ -36,17 +36,17 @@ - - + + - - + + - - + + diff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj index e4757543e..c0f92ac4a 100644 --- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj +++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj @@ -18,7 +18,7 @@ - + diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index cfbb85ea6..5941ed436 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -14,7 +14,7 @@ - + diff --git a/jellyfin.ruleset b/jellyfin.ruleset index 0a60c8c7a..1249a60c0 100644 --- a/jellyfin.ruleset +++ b/jellyfin.ruleset @@ -25,10 +25,14 @@ + + + + -- cgit v1.2.3 From 59518ec87e828aff21e5f0f67e82f00fc8fa13ba Mon Sep 17 00:00:00 2001 From: Khinenw Date: Sun, 14 Jul 2019 23:05:45 +0900 Subject: Fixed SMI to SRT UTF-16 Encoding bug --- CONTRIBUTORS.md | 1 + MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.MediaEncoding') diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9168dccc8..c96228f31 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -27,6 +27,7 @@ - [pjeanjean](https://github.com/pjeanjean) - [DrPandemic](https://github.com/drpandemic) - [joern-h](https://github.com/joern-h) + - [Khinenw](https://github.com/HelloWorld017) # Emby Contributors diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index 8677b363f..9ddfb9b01 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -425,7 +425,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles var encodingParam = await GetSubtitleFileCharacterSet(inputPath, language, inputProtocol, cancellationToken).ConfigureAwait(false); - if (!string.IsNullOrEmpty(encodingParam)) + // FFmpeg automatically convert character encoding when it is UTF-16 + // If we specify character encoding, it rejects with "do not specify a character encoding" and "Unable to recode subtitle event" + if ((inputPath.EndsWith(".smi") || inputPath.EndsWith(".sami")) && (encodingParam == "UTF-16BE" || encodingParam == "UTF-16LE")) + { + encodingParam = ""; + } + else if (!string.IsNullOrEmpty(encodingParam)) { encodingParam = " -sub_charenc " + encodingParam; } -- cgit v1.2.3