From 04e8e2d82dfe2bf62f743085f5feb8ebab0d2ad4 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Thu, 18 Jun 2020 21:57:02 -0700 Subject: [PATCH] Fix passthrough video setting --- ffmpeg.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ffmpeg.go b/ffmpeg.go index 8e8d24e36..3d761ca82 100644 --- a/ffmpeg.go +++ b/ffmpeg.go @@ -109,9 +109,16 @@ func startFfmpeg(configuration Config) { var videoMapsString = "" var audioMapsString = "" var streamMappingString = "" + var profileString = "" + if configuration.VideoSettings.EnablePassthrough || len(configuration.VideoSettings.StreamQualities) == 0 { fmt.Println("Enabling passthrough video") streamMaps = append(streamMaps, fmt.Sprintf("v:%d,a:%d", 0, 0)) + videoMaps = append(videoMaps, "-map v:0 -c:v copy") + videoMapsString = strings.Join(videoMaps, " ") + audioMaps = append(audioMaps, "-map a:0") + audioMapsString = strings.Join(audioMaps, " ") + " -c:a copy" // Pass through audio for all the variants, don't reencode + } else { for index, quality := range configuration.VideoSettings.StreamQualities { maxRate := math.Floor(float64(quality.Bitrate) * 0.8) @@ -120,6 +127,7 @@ func startFfmpeg(configuration Config) { videoMapsString = strings.Join(videoMaps, " ") audioMaps = append(audioMaps, "-map a:0") audioMapsString = strings.Join(audioMaps, " ") + " -c:a copy" // Pass through audio for all the variants, don't reencode + profileString = "-profile:v high" // Main – for standard definition (SD) to 640×480, High – for high definition (HD) to 1920×1080 } } @@ -141,7 +149,7 @@ func startFfmpeg(configuration Config) { // "-r 25", "-preset " + configuration.VideoSettings.EncoderPreset, "-sc_threshold 0", // don't create key frames on scene change - only according to -g - "-profile:v high", // Main – for standard definition (SD) to 640×480, High – for high definition (HD) to 1920×1080 + profileString, "-movflags +faststart", "-pix_fmt yuv420p", "-f hls",