diff --git a/transcoder/src/hwaccel.go b/transcoder/src/hwaccel.go index c96231f8..53e4853b 100644 --- a/transcoder/src/hwaccel.go +++ b/transcoder/src/hwaccel.go @@ -20,6 +20,8 @@ func DetectHardwareAccel() HwAccelT { EncodeFlags: []string{ "-c:v", "h264_nvenc", "-preset", "fast", + // the exivalent of -sc_threshold on nvidia. + "-no-scenecut", "1", }, // if the decode goes into system memory, we need to prepend the filters with "hwupload_cuda". // since we use hwaccel_output_format, decoded data stays in gpu memory so we must not specify it (it errors) @@ -33,6 +35,10 @@ func DetectHardwareAccel() HwAccelT { "-c:v", "libx264", // superfast or ultrafast would produce a file extremly big so we prever veryfast or faster. "-preset", "faster", + // sc_threshold is a scene detection mechanisum used to create a keyframe when the scene changes + // this is on by default and inserts keyframes where we don't want to (it also breaks force_key_frames) + // we disable it to prevents whole scenes from behing removed due to the -f segment failing to find the corresonding keyframe + "-sc_threshold", "0", }, // we could put :force_original_aspect_ratio=decrease:force_divisible_by=2 here but we already calculate a correct width and // aspect ratio in our code so there is no need. diff --git a/transcoder/src/videostream.go b/transcoder/src/videostream.go index 5a936639..7f7ddd6e 100644 --- a/transcoder/src/videostream.go +++ b/transcoder/src/videostream.go @@ -64,10 +64,6 @@ func (vs *VideoStream) getTranscodeArgs(segments string) []string { "-maxrate", fmt.Sprint(vs.quality.MaxBitrate()), // Force segments to be split exactly on keyframes (only works when transcoding) "-force_key_frames", segments, - // sc_threshold is a scene detection mechanisum used to create a keyframe when the scene changes - // this is on by default and inserts keyframes where we don't want to (it also breaks force_key_frames) - // we disable it to prevents whole scenes from behing removed due to the -f segment failing to find the corresonding keyframe - "-sc_threshold", "0", "-strict", "-2", ) return args