Files
ersatztv/ErsatzTV.FFmpeg/Encoder/Vaapi/EncoderHevcVaapi.cs
T
Jason DoveandGitHub e250e93a8e add support for embedded text subtitles (#742)
* first pass at text subtitle support

* support text subtitles from movies, music videos and other videos

* fixes

* qsv fixes

* vaapi fixes

* update changelog
2022-04-19 12:57:24 -05:00

47 lines
1.4 KiB
C#

using ErsatzTV.FFmpeg.Format;
namespace ErsatzTV.FFmpeg.Encoder.Vaapi;
public class EncoderHevcVaapi : EncoderBase
{
private readonly FrameState _currentState;
private readonly Option<WatermarkInputFile> _maybeWatermarkInputFile;
private readonly Option<SubtitleInputFile> _maybeSubtitleInputFile;
public EncoderHevcVaapi(
FrameState currentState,
Option<WatermarkInputFile> maybeWatermarkInputFile,
Option<SubtitleInputFile> maybeSubtitleInputFile)
{
_currentState = currentState;
_maybeWatermarkInputFile = maybeWatermarkInputFile;
_maybeSubtitleInputFile = maybeSubtitleInputFile;
}
public override FrameState NextState(FrameState currentState) => currentState with
{
VideoFormat = VideoFormat.Hevc
// don't change the frame data location
};
public override string Name => "hevc_vaapi";
public override StreamKind Kind => StreamKind.Video;
// need to upload if we're still in software unless a watermark or subtitle is used
public override string Filter
{
get
{
if (_currentState.FrameDataLocation == FrameDataLocation.Software)
{
if (_maybeWatermarkInputFile.IsNone && _maybeSubtitleInputFile.IsNone)
{
return "format=nv12|vaapi,hwupload";
}
}
return string.Empty;
}
}
}