|
|
|
@ -181,14 +181,7 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService |
|
|
|
|
|
|
|
|
|
|
|
string videoFormat = GetVideoFormat(playbackSettings); |
|
|
|
string videoFormat = GetVideoFormat(playbackSettings); |
|
|
|
|
|
|
|
|
|
|
|
HardwareAccelerationMode hwAccel = playbackSettings.HardwareAcceleration switch |
|
|
|
HardwareAccelerationMode hwAccel = GetHardwareAccelerationMode(playbackSettings); |
|
|
|
{ |
|
|
|
|
|
|
|
HardwareAccelerationKind.Nvenc => HardwareAccelerationMode.Nvenc, |
|
|
|
|
|
|
|
HardwareAccelerationKind.Qsv => HardwareAccelerationMode.Qsv, |
|
|
|
|
|
|
|
HardwareAccelerationKind.Vaapi => HardwareAccelerationMode.Vaapi, |
|
|
|
|
|
|
|
HardwareAccelerationKind.VideoToolbox => HardwareAccelerationMode.VideoToolbox, |
|
|
|
|
|
|
|
_ => HardwareAccelerationMode.None |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OutputFormatKind outputFormat = channel.StreamingMode == StreamingMode.HttpLiveStreamingSegmenter |
|
|
|
OutputFormatKind outputFormat = channel.StreamingMode == StreamingMode.HttpLiveStreamingSegmenter |
|
|
|
? OutputFormatKind.Hls |
|
|
|
? OutputFormatKind.Hls |
|
|
|
@ -259,7 +252,9 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService |
|
|
|
Option<TimeSpan> duration, |
|
|
|
Option<TimeSpan> duration, |
|
|
|
string errorMessage, |
|
|
|
string errorMessage, |
|
|
|
bool hlsRealtime, |
|
|
|
bool hlsRealtime, |
|
|
|
long ptsOffset) |
|
|
|
long ptsOffset, |
|
|
|
|
|
|
|
VaapiDriver vaapiDriver, |
|
|
|
|
|
|
|
string vaapiDevice) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FFmpegPlaybackSettings playbackSettings = _playbackSettingsCalculator.CalculateErrorSettings( |
|
|
|
FFmpegPlaybackSettings playbackSettings = _playbackSettingsCalculator.CalculateErrorSettings( |
|
|
|
channel.StreamingMode, |
|
|
|
channel.StreamingMode, |
|
|
|
@ -335,11 +330,13 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService |
|
|
|
|
|
|
|
|
|
|
|
var videoInputFile = new VideoInputFile(videoPath, new List<VideoStream> { ffmpegVideoStream }); |
|
|
|
var videoInputFile = new VideoInputFile(videoPath, new List<VideoStream> { ffmpegVideoStream }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HardwareAccelerationMode hwAccel = GetHardwareAccelerationMode(playbackSettings); |
|
|
|
|
|
|
|
|
|
|
|
var ffmpegState = new FFmpegState( |
|
|
|
var ffmpegState = new FFmpegState( |
|
|
|
false, |
|
|
|
false, |
|
|
|
HardwareAccelerationMode.None, |
|
|
|
hwAccel, |
|
|
|
None, |
|
|
|
VaapiDriverName(hwAccel, vaapiDriver), |
|
|
|
None, |
|
|
|
VaapiDeviceName(hwAccel, vaapiDevice), |
|
|
|
playbackSettings.StreamSeek, |
|
|
|
playbackSettings.StreamSeek, |
|
|
|
duration, |
|
|
|
duration, |
|
|
|
channel.StreamingMode != StreamingMode.HttpLiveStreamingDirect, |
|
|
|
channel.StreamingMode != StreamingMode.HttpLiveStreamingDirect, |
|
|
|
@ -602,4 +599,14 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService |
|
|
|
FFmpegProfileVideoFormat.Copy => VideoFormat.Copy, |
|
|
|
FFmpegProfileVideoFormat.Copy => VideoFormat.Copy, |
|
|
|
_ => throw new ArgumentOutOfRangeException($"unexpected video format {playbackSettings.VideoFormat}") |
|
|
|
_ => throw new ArgumentOutOfRangeException($"unexpected video format {playbackSettings.VideoFormat}") |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static HardwareAccelerationMode GetHardwareAccelerationMode(FFmpegPlaybackSettings playbackSettings) => |
|
|
|
|
|
|
|
playbackSettings.HardwareAcceleration switch |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
HardwareAccelerationKind.Nvenc => HardwareAccelerationMode.Nvenc, |
|
|
|
|
|
|
|
HardwareAccelerationKind.Qsv => HardwareAccelerationMode.Qsv, |
|
|
|
|
|
|
|
HardwareAccelerationKind.Vaapi => HardwareAccelerationMode.Vaapi, |
|
|
|
|
|
|
|
HardwareAccelerationKind.VideoToolbox => HardwareAccelerationMode.VideoToolbox, |
|
|
|
|
|
|
|
_ => HardwareAccelerationMode.None |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|