omit input container when hw encoding

This commit is contained in:
Luke Pulverenti 2017-03-01 15:29:42 -05:00
parent 5d094874e5
commit a181425e54
4 changed files with 29 additions and 82 deletions

View File

@ -163,8 +163,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks);
var inputModifiers = "-fflags +genpts -async 1 -vsync -1";
var mapArgs = "-map 0 -ignore_unknown";
var commandLineArgs = "-i \"{0}\"{5} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3}{4} -y \"{1}\"";
var commandLineArgs = "-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4} -y \"{1}\"";
long startTimeTicks = 0;
//if (mediaSource.DateLiveStreamOpened.HasValue)
@ -207,7 +206,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
// do not copy aac because many players have difficulty with aac_latm
if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings && !string.Equals(inputAudioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
return "-codec:a copy";
return "-codec:a:0 copy";
}
var audioChannels = 2;
@ -216,7 +215,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
audioChannels = audioStream.Channels ?? audioChannels;
}
return "-codec:a aac -strict experimental -ab 320000";
return "-codec:a:0 aac -strict experimental -ab 320000";
}
private bool EncodeVideo(MediaSourceInfo mediaSource)

View File

@ -154,10 +154,6 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return "mpegts";
}
if (string.Equals(container, "mpg", StringComparison.OrdinalIgnoreCase))
{
return "mpeg";
}
// For these need to find out the ffmpeg names
if (string.Equals(container, "m2ts", StringComparison.OrdinalIgnoreCase))
{
@ -171,12 +167,21 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return null;
}
if (string.Equals(container, "mpg", StringComparison.OrdinalIgnoreCase))
{
return null;
}
if (string.Equals(container, "mpeg", StringComparison.OrdinalIgnoreCase))
{
return null;
}
return container;
}
public string GetDecoderFromCodec(string codec)
{
// For these need to find out the ffmpeg names
if (string.Equals(codec, "mp2", StringComparison.OrdinalIgnoreCase))
{
return null;
@ -185,6 +190,10 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return null;
}
if (string.Equals(codec, "eac3", StringComparison.OrdinalIgnoreCase))
{
return null;
}
return codec;
}
@ -1494,7 +1503,7 @@ namespace MediaBrowser.Controller.MediaEncoding
//inputModifier += " -noaccurate_seek";
}
if (!string.IsNullOrWhiteSpace(state.InputContainer) && state.VideoType == VideoType.VideoFile)
if (!string.IsNullOrWhiteSpace(state.InputContainer) && state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType))
{
var inputFormat = GetInputFormat(state.InputContainer);
if (!string.IsNullOrWhiteSpace(inputFormat))
@ -1504,7 +1513,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
// Only do this for video files due to sometimes unpredictable codec names coming from BDInfo
if (state.RunTimeTicks.HasValue && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType) && state.VideoType == VideoType.VideoFile)
if (state.RunTimeTicks.HasValue && state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType))
{
foreach (var stream in state.MediaSource.MediaStreams)
{

View File

@ -734,6 +734,16 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
}
var charsetFromLanguage = string.IsNullOrWhiteSpace(language)
? null
: GetSubtitleFileCharacterSetFromLanguage(language);
// This assumption should only be made for external subtitles
if (!string.IsNullOrWhiteSpace(charsetFromLanguage) && !string.Equals(charsetFromLanguage, "windows-1252", StringComparison.OrdinalIgnoreCase))
{
return charsetFromLanguage;
}
var charset = await DetectCharset(path, language, protocol, cancellationToken).ConfigureAwait(false);
if (!string.IsNullOrWhiteSpace(charset))
@ -746,12 +756,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
return charset;
}
if (!string.IsNullOrWhiteSpace(language))
{
return GetSubtitleFileCharacterSetFromLanguage(language);
}
return null;
return charsetFromLanguage;
}
public string GetSubtitleFileCharacterSetFromLanguage(string language)

View File

@ -827,72 +827,6 @@ namespace MediaBrowser.Model.Dto
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Video); }
}
/// <summary>
/// Gets a value indicating whether this instance is audio.
/// </summary>
/// <value><c>true</c> if this instance is audio; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool IsAudio
{
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Audio); }
}
/// <summary>
/// Gets a value indicating whether this instance is game.
/// </summary>
/// <value><c>true</c> if this instance is game; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool IsGame
{
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Game); }
}
/// <summary>
/// Gets a value indicating whether this instance is person.
/// </summary>
/// <value><c>true</c> if this instance is person; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool IsPerson
{
get { return StringHelper.EqualsIgnoreCase(Type, "Person"); }
}
[IgnoreDataMember]
public bool IsMusicGenre
{
get { return StringHelper.EqualsIgnoreCase(Type, "MusicGenre"); }
}
[IgnoreDataMember]
public bool IsGameGenre
{
get { return StringHelper.EqualsIgnoreCase(Type, "GameGenre"); }
}
[IgnoreDataMember]
public bool IsGenre
{
get { return StringHelper.EqualsIgnoreCase(Type, "Genre"); }
}
[IgnoreDataMember]
public bool IsArtist
{
get { return StringHelper.EqualsIgnoreCase(Type, "MusicArtist"); }
}
[IgnoreDataMember]
public bool IsAlbum
{
get { return StringHelper.EqualsIgnoreCase(Type, "MusicAlbum"); }
}
[IgnoreDataMember]
public bool IsStudio
{
get { return StringHelper.EqualsIgnoreCase(Type, "Studio"); }
}
/// <summary>
/// Gets or sets the program identifier.
/// </summary>