Files
ersatztv/ErsatzTV.FFmpeg/Encoder/Qsv/EncoderH264Qsv.cs
T
Jason Dove c96b800b52 ffmpeg lib fixes (#633)
* try to fix vaapi inconsistencies

* log unexpected data

* vaapi fixes

* disable 444 test

* add qsv deinterlace filter; qsv fixes

* add videotoolbox acceleration
2022-02-14 22:01:26 -06:00

44 lines
1.3 KiB
C#

using ErsatzTV.FFmpeg.Format;
namespace ErsatzTV.FFmpeg.Encoder.Qsv;
public class EncoderH264Qsv : EncoderBase
{
private readonly FrameState _currentState;
public EncoderH264Qsv(FrameState currentState)
{
_currentState = currentState;
}
public override FrameState NextState(FrameState currentState) => currentState with
{
VideoFormat = VideoFormat.H264,
FrameDataLocation = FrameDataLocation.Hardware
};
public override string Name => "h264_qsv";
public override StreamKind Kind => StreamKind.Video;
// need to convert to nv12 if we're still in software
public override string Filter
{
get
{
if (_currentState.FrameDataLocation == FrameDataLocation.Software)
{
// 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=64";
}
// default to nv12
return "format=nv12,hwupload=extra_hw_frames=64";
}
return string.Empty;
}
}
}