fix qsv audio sync (#2090)
This commit is contained in:
@@ -55,6 +55,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Fix HDR transcoding with NVIDIA accel for:
|
||||
- All NVIDIA docker users
|
||||
- Windows NVIDIA users who have set the `ETV_DISABLE_VULKAN` env var
|
||||
- Fix audio sync issue with QSV acceleration
|
||||
|
||||
## [25.2.0] - 2025-06-24
|
||||
### Added
|
||||
|
||||
@@ -135,7 +135,7 @@ public class HardwareCapabilitiesFactory : IHardwareCapabilitiesFactory
|
||||
|
||||
public async Task<QsvOutput> GetQsvOutput(string ffmpegPath, Option<string> qsvDevice)
|
||||
{
|
||||
var option = new QsvHardwareAccelerationOption(qsvDevice);
|
||||
var option = new QsvHardwareAccelerationOption(qsvDevice, FFmpegCapability.Software);
|
||||
var arguments = option.GlobalOptions.ToList();
|
||||
|
||||
arguments.AddRange(QsvArguments);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using ErsatzTV.FFmpeg.Format;
|
||||
using ErsatzTV.FFmpeg.Capabilities;
|
||||
using ErsatzTV.FFmpeg.Format;
|
||||
|
||||
namespace ErsatzTV.FFmpeg.GlobalOption.HardwareAcceleration;
|
||||
|
||||
public class QsvHardwareAccelerationOption : GlobalOption
|
||||
public class QsvHardwareAccelerationOption(Option<string> device, FFmpegCapability decodeCapability) : GlobalOption
|
||||
{
|
||||
private readonly Option<string> _qsvDevice;
|
||||
|
||||
// TODO: read this from ffmpeg output
|
||||
private readonly List<string> _supportedFFmpegFormats = new()
|
||||
{
|
||||
@@ -13,8 +12,6 @@ public class QsvHardwareAccelerationOption : GlobalOption
|
||||
FFmpegFormat.P010LE
|
||||
};
|
||||
|
||||
public QsvHardwareAccelerationOption(Option<string> qsvDevice) => _qsvDevice = qsvDevice;
|
||||
|
||||
public override string[] GlobalOptions
|
||||
{
|
||||
get
|
||||
@@ -29,9 +26,14 @@ public class QsvHardwareAccelerationOption : GlobalOption
|
||||
"-hwaccel_output_format", "qsv"
|
||||
};
|
||||
|
||||
if (decodeCapability is not FFmpegCapability.Hardware)
|
||||
{
|
||||
result.Clear();
|
||||
}
|
||||
|
||||
if (OperatingSystem.IsLinux())
|
||||
{
|
||||
foreach (string qsvDevice in _qsvDevice)
|
||||
foreach (string qsvDevice in device)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(qsvDevice))
|
||||
{
|
||||
|
||||
@@ -74,8 +74,6 @@ public class QsvPipelineBuilder : SoftwarePipelineBuilder
|
||||
encodeCapability = FFmpegCapability.Software;
|
||||
}
|
||||
|
||||
pipelineSteps.Add(new QsvHardwareAccelerationOption(ffmpegState.VaapiDevice));
|
||||
|
||||
bool isHevcOrH264 = videoStream.Codec is /*VideoFormat.Hevc or*/ VideoFormat.H264;
|
||||
bool is10Bit = videoStream.PixelFormat.Map(pf => pf.BitDepth).IfNone(8) == 10;
|
||||
|
||||
@@ -85,6 +83,14 @@ public class QsvPipelineBuilder : SoftwarePipelineBuilder
|
||||
decodeCapability = FFmpegCapability.Software;
|
||||
}
|
||||
|
||||
// QSV cannot always decode properly when seeking, so use software
|
||||
if (decodeCapability == FFmpegCapability.Hardware && ffmpegState.Start.Filter(s => s > TimeSpan.Zero).IsSome)
|
||||
{
|
||||
decodeCapability = FFmpegCapability.Software;
|
||||
}
|
||||
|
||||
pipelineSteps.Add(new QsvHardwareAccelerationOption(ffmpegState.VaapiDevice, decodeCapability));
|
||||
|
||||
// disable hw accel if decoder/encoder isn't supported
|
||||
return ffmpegState with
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user