diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-09-17 23:08:45 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-09-17 23:08:45 -0400 |
| commit | 5340bfe8da879ba2503cb675e6724ce33b754ae3 (patch) | |
| tree | 88485bba22d97939b29e5078d2406021cb711120 /MediaBrowser.Server.Startup.Common/FFMpeg | |
| parent | 2acd1665c9b2d6fb087e131805f881d2f596f5c4 (diff) | |
added setting for intel qsv hardware decoding
Diffstat (limited to 'MediaBrowser.Server.Startup.Common/FFMpeg')
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs | 20 | ||||
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs | 86 |
2 files changed, 53 insertions, 53 deletions
diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs index 2910479ef8..c4fe7e43b5 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs @@ -33,7 +33,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg case OperatingSystem.Linux: info.ArchiveType = "7z"; - info.Version = "20150717"; + info.Version = "20150917"; break; case OperatingSystem.Osx: @@ -42,7 +42,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg switch (environment.SystemArchitecture) { case Architecture.X86_X64: - info.Version = "20150827"; + info.Version = "20150917"; break; case Architecture.X86: info.Version = "20150110"; @@ -54,7 +54,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg info.FFMpegFilename = "ffmpeg.exe"; info.FFProbeFilename = "ffprobe.exe"; - info.Version = "20150717"; + info.Version = "20150916"; info.ArchiveType = "7z"; switch (environment.SystemArchitecture) @@ -83,14 +83,14 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg case Architecture.X86_X64: return new[] { - "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20150717-git-8250943-win64-static.7z", - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150901-git-b54e03c-win64-static.7z" + "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20150916-git-cbbd906-win64-static.7z", + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150916-git-cbbd906-win64-static.7z" }; case Architecture.X86: return new[] { - "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20150717-git-8250943-win32-static.7z", - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150901-git-b54e03c-win32-static.7z" + "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20150916-git-cbbd906-win32-static.7z", + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150916-git-cbbd906-win32-static.7z" }; } break; @@ -102,7 +102,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg case Architecture.X86_X64: return new[] { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.7.2.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.0.7z" }; case Architecture.X86: return new[] @@ -119,12 +119,12 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg case Architecture.X86_X64: return new[] { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.7.1-64bit-static.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.8.0-64bit-static.7z" }; case Architecture.X86: return new[] { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.7.1-32bit-static.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.8.0-32bit-static.7z" }; } break; diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs index 54cd1357a6..d3388f47e5 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs @@ -7,6 +7,7 @@ using System.Globalization; using System.IO; using System.Text; using MediaBrowser.Common.IO; +using System.Collections.Generic; namespace MediaBrowser.Server.Startup.Common.FFMpeg { @@ -23,71 +24,65 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg _fileSystem = fileSystem; } - public void Validate(FFMpegInfo info) + public Tuple<List<string>,List<string>> Validate(FFMpegInfo info) { _logger.Info("FFMpeg: {0}", info.EncoderPath); _logger.Info("FFProbe: {0}", info.ProbePath); - string cacheKey; + var decoders = GetDecoders(info.EncoderPath); + var encoders = GetEncoders(info.EncoderPath); - try - { - cacheKey = new FileInfo(info.EncoderPath).Length.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N"); - } - catch (IOException) - { - // This could happen if ffmpeg is coming from a Path variable and we don't have the full path - cacheKey = Guid.NewGuid().ToString("N"); - } - catch - { - cacheKey = Guid.NewGuid().ToString("N"); - } - - var cachePath = Path.Combine(_appPaths.CachePath, "1" + cacheKey); - - ValidateCodecs(info.EncoderPath, cachePath); + return new Tuple<List<string>, List<string>>(decoders, encoders); } - private void ValidateCodecs(string ffmpegPath, string cachePath) + private List<string> GetDecoders(string ffmpegPath) { - string output = null; + string output = string.Empty; try { - output = _fileSystem.ReadAllText(cachePath, Encoding.UTF8); + output = GetFFMpegOutput(ffmpegPath, "-decoders"); } catch { - } - if (string.IsNullOrWhiteSpace(output)) + var found = new List<string>(); + var required = new[] { - try - { - output = GetFFMpegOutput(ffmpegPath, "-encoders"); - } - catch - { - return; - } + "h264_qsv", + "mpeg2_qsv", + "vc1_qsv" + }; - try + foreach (var codec in required) + { + var srch = " " + codec + " "; + + if (output.IndexOf(srch, StringComparison.OrdinalIgnoreCase) == -1) { - _fileSystem.CreateDirectory(Path.GetDirectoryName(cachePath)); - _fileSystem.WriteAllText(cachePath, output, Encoding.UTF8); + _logger.Warn("ffmpeg is missing decoder " + codec); } - catch + else { - + found.Add(codec); } } - ValidateCodecsFromOutput(output); + return found; } - private void ValidateCodecsFromOutput(string output) + private List<string> GetEncoders(string ffmpegPath) { + string output = null; + try + { + output = GetFFMpegOutput(ffmpegPath, "-encoders"); + } + catch + { + } + + var found = new List<string>(); var required = new[] { "libx264", @@ -103,16 +98,21 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg "srt" }; - foreach (var encoder in required) + foreach (var codec in required) { - var srch = " " + encoder + " "; + var srch = " " + codec + " "; if (output.IndexOf(srch, StringComparison.OrdinalIgnoreCase) == -1) { - _logger.Error("ffmpeg is missing encoder " + encoder); - //throw new ArgumentException("ffmpeg is missing encoder " + encoder); + _logger.Warn("ffmpeg is missing encoder " + codec); + } + else + { + found.Add(codec); } } + + return found; } private string GetFFMpegOutput(string path, string arguments) |
