From 9b39404b9a178e262fb50a2718b9daedb93f71f3 Mon Sep 17 00:00:00 2001 From: Lynxy Date: Thu, 21 Feb 2019 19:50:57 -0500 Subject: [PATCH 1/3] Always set ffmpeg flag +genpts when video stream is being copied --- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index f5f147db1b..264a45d24a 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1904,7 +1904,7 @@ namespace MediaBrowser.Controller.MediaEncoding { flags.Add("+ignidx"); } - if (state.GenPtsInput) + if (state.GenPtsInput || string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)) { flags.Add("+genpts"); } @@ -2436,6 +2436,8 @@ namespace MediaBrowser.Controller.MediaEncoding if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase)) { + args += " -flags -global_header -fflags +genpts"; + if (state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase)) @@ -2447,11 +2449,6 @@ namespace MediaBrowser.Controller.MediaEncoding { args += " -copyts -avoid_negative_ts disabled -start_at_zero"; } - - if (!state.RunTimeTicks.HasValue) - { - args += " -flags -global_header -fflags +genpts"; - } } else { From eb95b025d43b1d937fccaa0b0f10cbce24fcfae1 Mon Sep 17 00:00:00 2001 From: Lynxy Date: Fri, 22 Feb 2019 23:28:19 -0500 Subject: [PATCH 2/3] Add to contributors --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 758202af6c..0831e1340e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -21,6 +21,7 @@ - [WillWill56](https://github.com/WillWill56) - [Liggy](https://github.com/Liggy) - [fruhnow](https://github.com/fruhnow) + - [Lynxy](https://github.com/Lynxy) # Emby Contributors From 67f399dccf8f6887397d8c308ea5c0c93d2e4e06 Mon Sep 17 00:00:00 2001 From: The Lynxy Date: Sat, 23 Feb 2019 10:01:41 -0500 Subject: [PATCH 3/3] Leave +genpts untouched in GetProgressiveVideoArguments() --- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 264a45d24a..e378c2b89d 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -2436,8 +2436,6 @@ namespace MediaBrowser.Controller.MediaEncoding if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase)) { - args += " -flags -global_header -fflags +genpts"; - if (state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase)) @@ -2449,6 +2447,11 @@ namespace MediaBrowser.Controller.MediaEncoding { args += " -copyts -avoid_negative_ts disabled -start_at_zero"; } + + if (!state.RunTimeTicks.HasValue) + { + args += " -flags -global_header -fflags +genpts"; + } } else {