|
|
|
@ -397,7 +397,7 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
|
|
|
|
|
var assSubtitleParam = string.Empty;
|
|
|
|
|
var copyTsParam = string.Empty;
|
|
|
|
|
var yadifParam = "yadif=0:-1:0,";
|
|
|
|
|
var yadifParam = state.DeInterlace ? "yadif=0:-1:0," : string.Empty;
|
|
|
|
|
|
|
|
|
|
var request = state.VideoRequest;
|
|
|
|
|
|
|
|
|
@ -419,7 +419,7 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
var widthParam = request.Width.Value.ToString(UsCulture);
|
|
|
|
|
var heightParam = request.Height.Value.ToString(UsCulture);
|
|
|
|
|
|
|
|
|
|
return string.Format("{4} -vf \"{0}scale=trunc({1}/2)*2:trunc({2}/2)*2{3}\"",yadifParam, widthParam, heightParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
return string.Format("{4} -vf \"{0}scale=trunc({1}/2)*2:trunc({2}/2)*2{3}\"", yadifParam, widthParam, heightParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var isH264Output = outputVideoCodec.Equals("libx264", StringComparison.OrdinalIgnoreCase);
|
|
|
|
@ -430,8 +430,8 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
var widthParam = request.Width.Value.ToString(UsCulture);
|
|
|
|
|
|
|
|
|
|
return isH264Output ?
|
|
|
|
|
string.Format("{3} -vf \"{0}scale={1}:trunc(ow/a/2)*2{2}\"",yadifParam, widthParam, assSubtitleParam, copyTsParam) :
|
|
|
|
|
string.Format("{3} -vf \"{0}scale={1}:-1{2}\"",yadifParam, widthParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
string.Format("{3} -vf \"{0}scale={1}:trunc(ow/a/2)*2{2}\"", yadifParam, widthParam, assSubtitleParam, copyTsParam) :
|
|
|
|
|
string.Format("{3} -vf \"{0}scale={1}:-1{2}\"", yadifParam, widthParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If a fixed height was requested
|
|
|
|
@ -440,8 +440,8 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
var heightParam = request.Height.Value.ToString(UsCulture);
|
|
|
|
|
|
|
|
|
|
return isH264Output ?
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=trunc(oh*a*2)/2:{1}{2}\"",yadifParam, heightParam, assSubtitleParam, copyTsParam) :
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=-1:{1}{2}\"",yadifParam, heightParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=trunc(oh*a*2)/2:{1}{2}\"", yadifParam, heightParam, assSubtitleParam, copyTsParam) :
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=-1:{1}{2}\"", yadifParam, heightParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If a max width was requested
|
|
|
|
@ -450,8 +450,8 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
var maxWidthParam = request.MaxWidth.Value.ToString(UsCulture);
|
|
|
|
|
|
|
|
|
|
return isH264Output ?
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=min(iw\\,{1}):trunc(ow/a/2)*2{2}\"",yadifParam, maxWidthParam, assSubtitleParam, copyTsParam) :
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=min(iw\\,{1}):-1{2}\"",yadifParam, maxWidthParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=min(iw\\,{1}):trunc(ow/a/2)*2{2}\"", yadifParam, maxWidthParam, assSubtitleParam, copyTsParam) :
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=min(iw\\,{1}):-1{2}\"", yadifParam, maxWidthParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If a max height was requested
|
|
|
|
@ -460,8 +460,8 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture);
|
|
|
|
|
|
|
|
|
|
return isH264Output ?
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=trunc(oh*a*2)/2:min(ih\\,{1}){2}\"",yadifParam, maxHeightParam, assSubtitleParam, copyTsParam) :
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=-1:min(ih\\,{1}){2}\"",yadifParam, maxHeightParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=trunc(oh*a*2)/2:min(ih\\,{1}){2}\"", yadifParam, maxHeightParam, assSubtitleParam, copyTsParam) :
|
|
|
|
|
string.Format("{3} -vf \"{0}scale=-1:min(ih\\,{1}){2}\"", yadifParam, maxHeightParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state.VideoStream == null)
|
|
|
|
@ -484,11 +484,11 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
var widthParam = outputSize.Width.ToString(UsCulture);
|
|
|
|
|
var heightParam = outputSize.Height.ToString(UsCulture);
|
|
|
|
|
|
|
|
|
|
return string.Format("{4} -vf \"{0}scale=trunc({1}/2)*2:trunc({2}/2)*2{3}\"",yadifParam, widthParam, heightParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
return string.Format("{4} -vf \"{0}scale=trunc({1}/2)*2:trunc({2}/2)*2{3}\"", yadifParam, widthParam, heightParam, assSubtitleParam, copyTsParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Otherwise use -vf scale since ffmpeg will ensure internally that the aspect ratio is preserved
|
|
|
|
|
return string.Format("{3} -vf \"{0}scale={1}:-1{2}\"",yadifParam, Convert.ToInt32(outputSize.Width), assSubtitleParam, copyTsParam);
|
|
|
|
|
return string.Format("{3} -vf \"{0}scale={1}:-1{2}\"", yadifParam, Convert.ToInt32(outputSize.Width), assSubtitleParam, copyTsParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1061,6 +1061,7 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
//state.RunTimeTicks = recording.RunTimeTicks;
|
|
|
|
|
state.SendInputOverStandardInput = recording.RecordingInfo.Status == RecordingStatus.InProgress;
|
|
|
|
|
state.AudioSync = 1000;
|
|
|
|
|
state.DeInterlace = true;
|
|
|
|
|
}
|
|
|
|
|
else if (item is LiveTvChannel)
|
|
|
|
|
{
|
|
|
|
@ -1087,6 +1088,7 @@ namespace MediaBrowser.Api.Playback
|
|
|
|
|
|
|
|
|
|
state.SendInputOverStandardInput = true;
|
|
|
|
|
state.AudioSync = 1000;
|
|
|
|
|
state.DeInterlace = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|