add option to save recordings as mkv

This commit is contained in:
Luke Pulverenti 2016-09-08 02:41:49 -04:00
parent efebc78cf5
commit 323d410484
4 changed files with 27 additions and 10 deletions

View File

@ -13,6 +13,7 @@ namespace MediaBrowser.Model.LiveTv
public string SeriesRecordingPath { get; set; } public string SeriesRecordingPath { get; set; }
public bool EnableAutoOrganize { get; set; } public bool EnableAutoOrganize { get; set; }
public bool EnableRecordingEncoding { get; set; } public bool EnableRecordingEncoding { get; set; }
public string RecordingEncodingFormat { get; set; }
public bool EnableRecordingSubfolders { get; set; } public bool EnableRecordingSubfolders { get; set; }
public bool EnableOriginalAudioWithEncodedRecordings { get; set; } public bool EnableOriginalAudioWithEncodedRecordings { get; set; }
@ -31,6 +32,7 @@ namespace MediaBrowser.Model.LiveTv
TunerHosts = new List<TunerHostInfo>(); TunerHosts = new List<TunerHostInfo>();
ListingProviders = new List<ListingsProviderInfo>(); ListingProviders = new List<ListingsProviderInfo>();
MediaLocationsCreated = new string[] { }; MediaLocationsCreated = new string[] { };
RecordingEncodingFormat = "mp4";
} }
} }

View File

@ -46,9 +46,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
_httpClient = httpClient; _httpClient = httpClient;
} }
private string OutputFormat
{
get
{
var format = _liveTvOptions.RecordingEncodingFormat;
if (string.Equals(format, "mkv", StringComparison.OrdinalIgnoreCase))
{
return "mkv";
}
return "mp4";
}
}
public string GetOutputPath(MediaSourceInfo mediaSource, string targetFile) public string GetOutputPath(MediaSourceInfo mediaSource, string targetFile)
{ {
return Path.ChangeExtension(targetFile, ".mp4"); return Path.ChangeExtension(targetFile, "." + OutputFormat);
} }
public async Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken) public async Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
@ -233,15 +248,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private string GetAudioArgs(MediaSourceInfo mediaSource) private string GetAudioArgs(MediaSourceInfo mediaSource)
{ {
// do not copy aac because many players have difficulty with aac_latm
var copyAudio = new[] { "mp3" };
var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>(); var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>();
var inputAudioCodec = mediaStreams.Where(i => i.Type == MediaStreamType.Audio).Select(i => i.Codec).FirstOrDefault() ?? string.Empty; var inputAudioCodec = mediaStreams.Where(i => i.Type == MediaStreamType.Audio).Select(i => i.Codec).FirstOrDefault() ?? string.Empty;
if (copyAudio.Contains(inputAudioCodec, StringComparer.OrdinalIgnoreCase)) // do not copy aac because many players have difficulty with aac_latm
{
return "-codec:a:0 copy";
}
if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings && !string.Equals(inputAudioCodec, "aac", StringComparison.OrdinalIgnoreCase)) if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings && !string.Equals(inputAudioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{ {
return "-codec:a:0 copy"; return "-codec:a:0 copy";

View File

@ -331,7 +331,7 @@ namespace MediaBrowser.ServerApplication
Application.Run(); Application.Run();
} }
private static SplashForm _splash; internal static SplashForm _splash;
private static Thread _splashThread; private static Thread _splashThread;
private static void ShowSplashScreen(Version appVersion, Progress<double> progress, ILogger logger) private static void ShowSplashScreen(Version appVersion, Progress<double> progress, ILogger logger)
{ {

View File

@ -212,7 +212,12 @@ namespace MediaBrowser.ServerApplication.Native
private bool Confirm() private bool Confirm()
{ {
return MessageBox.Show("Emby has detected that Windows Firewall has been configured in a way that may prevent your other devices from accessing Emby Server. Click OK to remove this rule, or cancel to proceed anyway.", "Windows Firewall", MessageBoxButtons.OKCancel) == DialogResult.OK; if (MainStartup._splash == null)
{
return false;
}
return MessageBox.Show(MainStartup._splash, "Emby has detected that Windows Firewall has been configured in a way that may prevent your other devices from accessing Emby Server. Click OK to remove this rule, or cancel to proceed anyway.", "Windows Firewall", MessageBoxButtons.OKCancel) == DialogResult.OK;
} }
public bool PortsRequireAuthorization(string applicationPath) public bool PortsRequireAuthorization(string applicationPath)
@ -242,7 +247,7 @@ namespace MediaBrowser.ServerApplication.Native
if (data.IndexOf("Block", StringComparison.OrdinalIgnoreCase) != -1) if (data.IndexOf("Block", StringComparison.OrdinalIgnoreCase) != -1)
{ {
_logger.Info("Found windows firewall rule: " + data); _logger.Info("Found potential windows firewall rule blocking Emby Server: " + data);
return Confirm(); return Confirm();
} }