Add check if output container supports "global_header" flag

This commit is contained in:
Waldemar Tomme 2019-12-22 13:01:18 +01:00
parent 06dfa2e687
commit 57aec873d0

View file

@ -2750,6 +2750,8 @@ namespace MediaBrowser.Controller.MediaEncoding
args += " -mpegts_m2ts_mode 1"; args += " -mpegts_m2ts_mode 1";
} }
var supportsGlobalHeaderFlag = state.OutputContainer != "mkv";
if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase)) if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{ {
if (state.VideoStream != null if (state.VideoStream != null
@ -2770,7 +2772,12 @@ namespace MediaBrowser.Controller.MediaEncoding
if (!state.RunTimeTicks.HasValue) if (!state.RunTimeTicks.HasValue)
{ {
args += " -flags -global_header -fflags +genpts"; if(supportsGlobalHeaderFlag)
{
args += " -flags -global_header";
}
args += " -fflags +genpts";
} }
} }
else else
@ -2816,7 +2823,7 @@ namespace MediaBrowser.Controller.MediaEncoding
args += " " + qualityParam.Trim(); args += " " + qualityParam.Trim();
} }
if (!state.RunTimeTicks.HasValue) if (supportsGlobalHeaderFlag && !state.RunTimeTicks.HasValue)
{ {
args += " -flags -global_header"; args += " -flags -global_header";
} }