relocate more ffmpeg params. add channel delay

This commit is contained in:
Luke Pulverenti 2014-01-21 22:07:33 -05:00
parent 3d697cdab2
commit cf1dac60f6
4 changed files with 23 additions and 17 deletions

View File

@ -622,7 +622,7 @@ namespace MediaBrowser.Api.Playback
/// <param name="videoType">Type of the video.</param>
/// <param name="isoType">Type of the iso.</param>
/// <returns>System.String.</returns>
protected string GetProbeSizeArgument(string mediaPath, bool isVideo, VideoType? videoType, IsoType? isoType)
private string GetProbeSizeArgument(string mediaPath, bool isVideo, VideoType? videoType, IsoType? isoType)
{
var type = !isVideo ? MediaEncoderHelpers.GetInputType(null, null) :
MediaEncoderHelpers.GetInputType(videoType, isoType);
@ -918,7 +918,7 @@ namespace MediaBrowser.Api.Playback
/// </summary>
/// <param name="path">The path.</param>
/// <returns>System.String.</returns>
protected string GetUserAgentParam(string path)
private string GetUserAgentParam(string path)
{
var useragent = GetUserAgent(path);
@ -1092,6 +1092,8 @@ namespace MediaBrowser.Api.Playback
state.AudioSync = 1000;
state.DeInterlace = true;
state.InputFormat = "mpegts";
await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
}
else
{
@ -1147,6 +1149,21 @@ namespace MediaBrowser.Api.Playback
{
var inputModifier = string.Empty;
var probeSize = GetProbeSizeArgument(state.MediaPath, state.IsInputVideo, state.VideoType, state.IsoType);
inputModifier += " " + probeSize;
inputModifier = inputModifier.Trim();
inputModifier += " " + GetUserAgentParam(state.MediaPath);
inputModifier = inputModifier.Trim();
inputModifier += " " + GetFastSeekCommandLineParameter(state.Request);
inputModifier = inputModifier.Trim();
if (state.VideoRequest != null)
{
inputModifier += " -fflags genpts";
}
if (!string.IsNullOrEmpty(state.InputFormat))
{
inputModifier += " -f " + state.InputFormat;
@ -1161,7 +1178,7 @@ namespace MediaBrowser.Api.Playback
{
inputModifier += " -acodec " + state.InputAudioCodec;
}
if (state.ReadInputAtNativeFramerate)
{
inputModifier += " -re";

View File

@ -262,8 +262,6 @@ namespace MediaBrowser.Api.Playback.Hls
/// <returns>System.String.</returns>
protected override string GetCommandLineArguments(string outputPath, StreamState state, bool performSubtitleConversions)
{
var probeSize = GetProbeSizeArgument(state.MediaPath, state.IsInputVideo, state.VideoType, state.IsoType);
var hlsVideoRequest = state.VideoRequest as GetHlsVideoStream;
var itsOffsetMs = hlsVideoRequest == null
@ -276,11 +274,8 @@ namespace MediaBrowser.Api.Playback.Hls
var inputModifier = GetInputModifier(state);
var args = string.Format("{0}{1} {2} {3} -fflags genpts{4} -i {5}{6} -map_metadata -1 -threads {7} {8} {9} -sc_threshold 0 {10} -hls_time {11} -start_number 0 -hls_list_size 1440 \"{12}\"",
var args = string.Format("{0} {1} -i {2}{3} -map_metadata -1 -threads {4} {5} {6} -sc_threshold 0 {7} -hls_time {8} -start_number 0 -hls_list_size 1440 \"{9}\"",
itsOffset,
probeSize,
GetUserAgentParam(state.MediaPath),
GetFastSeekCommandLineParameter(state.Request),
inputModifier,
GetInputArgument(state),
GetSlowSeekCommandLineParameter(state.Request),

View File

@ -106,8 +106,7 @@ namespace MediaBrowser.Api.Playback.Progressive
var inputModifier = GetInputModifier(state);
return string.Format("{0}{1} -i {2}{3} -threads {4}{5} {6} -id3v2_version 3 -write_id3v1 1 \"{7}\"",
GetFastSeekCommandLineParameter(request),
return string.Format("{0} -i {1}{2} -threads {3}{4} {5} -id3v2_version 3 -write_id3v1 1 \"{6}\"",
inputModifier,
GetInputArgument(state),
GetSlowSeekCommandLineParameter(request),

View File

@ -91,8 +91,6 @@ namespace MediaBrowser.Api.Playback.Progressive
/// <returns>System.String.</returns>
protected override string GetCommandLineArguments(string outputPath, StreamState state, bool performSubtitleConversions)
{
var probeSize = GetProbeSizeArgument(state.MediaPath, state.IsInputVideo, state.VideoType, state.IsoType);
// Get the output codec name
var videoCodec = GetVideoCodec(state.VideoRequest);
@ -108,10 +106,7 @@ namespace MediaBrowser.Api.Playback.Progressive
var inputModifier = GetInputModifier(state);
return string.Format("{0} {1} {2} -fflags genpts{3} -i {4}{5}{6} {7} {8} -map_metadata -1 -threads {9} {10}{11} \"{12}\"",
probeSize,
GetUserAgentParam(state.MediaPath),
GetFastSeekCommandLineParameter(state.Request),
return string.Format("{0} -i {1}{2}{3} {4} {5} -map_metadata -1 -threads {6} {7}{8} \"{9}\"",
inputModifier,
GetInputArgument(state),
GetSlowSeekCommandLineParameter(state.Request),