Browse Source

limit nvidia workaround to h264 (#2448)

pull/2450/head
Jason Dove 3 months ago committed by GitHub
parent
commit
0ca1859802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 6
      ErsatzTV.FFmpeg/Encoder/Nvenc/EncoderHevcNvenc.cs
  3. 2
      ErsatzTV.FFmpeg/OutputOption/NvidiaGreenLineWorkaroundFilter.cs
  4. 2
      ErsatzTV.FFmpeg/Pipeline/NvidiaPipelineBuilder.cs

2
CHANGELOG.md

@ -64,7 +64,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -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

6
ErsatzTV.FFmpeg/Encoder/Nvenc/EncoderHevcNvenc.cs

@ -7,10 +7,12 @@ public class EncoderHevcNvenc : EncoderBase @@ -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 @@ -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)

2
ErsatzTV.FFmpeg/OutputOption/NvidiaGreenLineWorkaroundFilter.cs

@ -8,7 +8,7 @@ public class NvidiaGreenLineWorkaroundFilter(string videoFormat, FrameSize frame @@ -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 [];
}

2
ErsatzTV.FFmpeg/Pipeline/NvidiaPipelineBuilder.cs

@ -307,7 +307,7 @@ public class NvidiaPipelineBuilder : SoftwarePipelineBuilder @@ -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),

Loading…
Cancel
Save