limit nvidia workaround to h264 (#2448)

This commit is contained in:
Jason Dove
2025-09-20 17:31:55 +00:00
committed by GitHub
parent 07a160fcc6
commit 0ca1859802
4 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix deco dead air fallback selection and duration on mirror channels
- Fix fallback filler duration on mirror channels
- Fix slow startup caused by check for overlapping playout items
- Fix green line in *most* cases when overlaying content using NVIDIA acceleration
- Fix green line in *most* cases when overlaying content using NVIDIA acceleration and H264 output
### Changed
- Filler presets: use separate text fields for `hours`, `minutes` and `seconds` duration
@@ -7,10 +7,12 @@ public class EncoderHevcNvenc : EncoderBase
{
private readonly bool _bFrames;
private readonly Option<string> _maybeVideoPreset;
private readonly bool _allowBFrames;
public EncoderHevcNvenc(IHardwareCapabilities hardwareCapabilities, Option<string> maybeVideoPreset)
public EncoderHevcNvenc(IHardwareCapabilities hardwareCapabilities, Option<string> maybeVideoPreset, bool allowBFrames)
{
_maybeVideoPreset = maybeVideoPreset;
_allowBFrames = allowBFrames;
if (hardwareCapabilities is NvidiaHardwareCapabilities nvidia)
{
_bFrames = nvidia.HevcBFrames;
@@ -28,7 +30,7 @@ public class EncoderHevcNvenc : EncoderBase
{
"-c:v", "hevc_nvenc",
"-tag:v", "hvc1",
"-b_ref_mode", _bFrames ? "1" : "0"
"-b_ref_mode", _allowBFrames && _bFrames ? "1" : "0"
};
foreach (string videoPreset in _maybeVideoPreset)
@@ -8,7 +8,7 @@ public class NvidiaGreenLineWorkaroundFilter(string videoFormat, FrameSize frame
{
get
{
if (videoFormat is not (VideoFormat.Hevc or VideoFormat.H264))
if (videoFormat is not VideoFormat.H264)
{
return [];
}
@@ -307,7 +307,7 @@ public class NvidiaPipelineBuilder : SoftwarePipelineBuilder
(ffmpegState.EncoderHardwareAccelerationMode, desiredState.VideoFormat) switch
{
(HardwareAccelerationMode.Nvenc, VideoFormat.Hevc) =>
new EncoderHevcNvenc(_hardwareCapabilities, desiredState.VideoPreset),
new EncoderHevcNvenc(_hardwareCapabilities, desiredState.VideoPreset, desiredState.AllowBFrames),
(HardwareAccelerationMode.Nvenc, VideoFormat.H264) =>
new EncoderH264Nvenc(desiredState.VideoProfile, desiredState.VideoPreset),