fix qsv encoder regression and memory errors (#828)

* fix qsv encoders; only use 64 extra hw frames

* update changelog
This commit is contained in:
Jason Dove
2022-05-31 06:07:50 -05:00
committed by GitHub
parent 18e66a92ad
commit ca5d303ac7
8 changed files with 13 additions and 12 deletions

View File

@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Additional fix for duplicate `Other Videos` entries; trash may need to be emptied one last time after upgrading
- Fix watermark opacity in cultures where `,` is a decimal separator
- Rework playlist filtering to avoid empty playlist responses
- Fix some QSV/VAAPI memory errors by always requesting 64 extra hardware frames
### Added
- Enable QSV hardware acceleration for vaapi docker images

View File

@@ -20,7 +20,7 @@ public class EncoderH264Qsv : EncoderBase
public override string Name => "h264_qsv";
public override StreamKind Kind => StreamKind.Video;
public override IList<string> OutputOptions => new[] { "-low_power", "0" };
public override IList<string> OutputOptions => new[] { "-c:v", "h264_qsv", "-low_power", "0" };
// need to upload if we're still in software and a watermark is used
public override string Filter
@@ -37,11 +37,11 @@ public class EncoderH264Qsv : EncoderBase
// pixel format should already be converted to a supported format by QsvHardwareAccelerationOption
foreach (IPixelFormat pixelFormat in _currentState.PixelFormat)
{
return $"format={pixelFormat.FFmpegName},hwupload=extra_hw_frames=128";
return $"format={pixelFormat.FFmpegName},hwupload=extra_hw_frames=64";
}
// default to nv12
return "format=nv12,hwupload=extra_hw_frames=128";
return "format=nv12,hwupload=extra_hw_frames=64";
}
}

View File

@@ -20,7 +20,7 @@ public class EncoderHevcQsv : EncoderBase
public override string Name => "hevc_qsv";
public override StreamKind Kind => StreamKind.Video;
public override IList<string> OutputOptions => new[] { "-low_power", "0" };
public override IList<string> OutputOptions => new[] { "-c:v", "hevc_qsv", "-low_power", "0" };
// need to upload if we're still in software and a watermark is used
public override string Filter
@@ -37,11 +37,11 @@ public class EncoderHevcQsv : EncoderBase
// pixel format should already be converted to a supported format by QsvHardwareAccelerationOption
foreach (IPixelFormat pixelFormat in _currentState.PixelFormat)
{
return $"format={pixelFormat.FFmpegName},hwupload=extra_hw_frames=128";
return $"format={pixelFormat.FFmpegName},hwupload=extra_hw_frames=64";
}
// default to nv12
return "format=nv12,hwupload=extra_hw_frames=128";
return "format=nv12,hwupload=extra_hw_frames=64";
}
}

View File

@@ -10,7 +10,7 @@ public class HardwareUploadFilter : BaseFilter
{
HardwareAccelerationMode.None => string.Empty,
HardwareAccelerationMode.Nvenc => "hwupload_cuda",
HardwareAccelerationMode.Qsv => "hwupload=extra_hw_frames=128",
HardwareAccelerationMode.Qsv => "hwupload=extra_hw_frames=64",
HardwareAccelerationMode.Vaapi => "format=nv12|vaapi,hwupload",
_ => "hwupload"
};

View File

@@ -10,7 +10,7 @@ public class DeinterlaceQsvFilter : BaseFilter
// deinterlace_qsv seems to only support nv12, not p010le
public override string Filter => _currentState.FrameDataLocation == FrameDataLocation.Software
? "format=nv12,hwupload=extra_hw_frames=128,deinterlace_qsv"
? "format=nv12,hwupload=extra_hw_frames=64,deinterlace_qsv"
: "deinterlace_qsv";
public override FrameState NextState(FrameState currentState)

View File

@@ -49,10 +49,10 @@ public class ScaleQsvFilter : BaseFilter
string initialPixelFormat = _currentState.PixelFormat.Match(pf => pf.FFmpegName, FFmpegFormat.NV12);
if (!string.IsNullOrWhiteSpace(scale))
{
return $"format={initialPixelFormat},hwupload=extra_hw_frames=128,{scale}";
return $"format={initialPixelFormat},hwupload=extra_hw_frames=64,{scale}";
}
return $"format={initialPixelFormat},hwupload=extra_hw_frames=128";
return $"format={initialPixelFormat},hwupload=extra_hw_frames=64";
}
}

View File

@@ -16,7 +16,7 @@ public class SubtitleHardwareUploadFilter : BaseFilter
{
HardwareAccelerationMode.None => string.Empty,
HardwareAccelerationMode.Nvenc => "hwupload_cuda",
HardwareAccelerationMode.Qsv => "hwupload=extra_hw_frames=128",
HardwareAccelerationMode.Qsv => "hwupload=extra_hw_frames=64",
// leave vaapi in software since we don't (yet) use overlay_vaapi
HardwareAccelerationMode.Vaapi when _currentState.FrameDataLocation == FrameDataLocation.Software =>

View File

@@ -15,7 +15,7 @@ public class WatermarkHardwareUploadFilter : BaseFilter
{
HardwareAccelerationMode.None => string.Empty,
HardwareAccelerationMode.Nvenc => "hwupload_cuda",
HardwareAccelerationMode.Qsv => "hwupload=extra_hw_frames=128",
HardwareAccelerationMode.Qsv => "hwupload=extra_hw_frames=64",
// leave vaapi in software since we don't (yet) use overlay_vaapi
HardwareAccelerationMode.Vaapi when _currentState.FrameDataLocation == FrameDataLocation.Software =>