subtitle fixes for software, videotoolbox, vaapi (#736)
* fix subtitles using software encoders * videotoolbox fixes * fix some vaapi subtitle edge cases
This commit is contained in:
@@ -6,11 +6,16 @@ public class EncoderH264Vaapi : EncoderBase
|
||||
{
|
||||
private readonly FrameState _currentState;
|
||||
private readonly Option<WatermarkInputFile> _maybeWatermarkInputFile;
|
||||
private readonly Option<SubtitleInputFile> _maybeSubtitleInputFile;
|
||||
|
||||
public EncoderH264Vaapi(FrameState currentState, Option<WatermarkInputFile> maybeWatermarkInputFile)
|
||||
public EncoderH264Vaapi(
|
||||
FrameState currentState,
|
||||
Option<WatermarkInputFile> maybeWatermarkInputFile,
|
||||
Option<SubtitleInputFile> maybeSubtitleInputFile)
|
||||
{
|
||||
_currentState = currentState;
|
||||
_maybeWatermarkInputFile = maybeWatermarkInputFile;
|
||||
_maybeSubtitleInputFile = maybeSubtitleInputFile;
|
||||
}
|
||||
|
||||
public override FrameState NextState(FrameState currentState) => currentState with
|
||||
@@ -22,14 +27,19 @@ public class EncoderH264Vaapi : EncoderBase
|
||||
public override string Name => "h264_vaapi";
|
||||
public override StreamKind Kind => StreamKind.Video;
|
||||
|
||||
// need to upload if we're still in software unless a watermark is used
|
||||
// need to upload if we're still in software unless a watermark or picture subtitle is used
|
||||
public override string Filter
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_maybeWatermarkInputFile.IsNone && _currentState.FrameDataLocation == FrameDataLocation.Software)
|
||||
if (_currentState.FrameDataLocation == FrameDataLocation.Software)
|
||||
{
|
||||
return "format=nv12|vaapi,hwupload";
|
||||
bool isNotImageSubtitle = _maybeSubtitleInputFile.Map(s => s.IsImageBased).IfNone(false) == false;
|
||||
|
||||
if (_maybeWatermarkInputFile.IsNone && isNotImageSubtitle)
|
||||
{
|
||||
return "format=nv12|vaapi,hwupload";
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user