|
|
|
@ -132,7 +132,7 @@ public class TranscodingTests |
|
|
|
public static ScalingBehavior[] ScalingBehaviors = |
|
|
|
public static ScalingBehavior[] ScalingBehaviors = |
|
|
|
[ |
|
|
|
[ |
|
|
|
ScalingBehavior.ScaleAndPad, |
|
|
|
ScalingBehavior.ScaleAndPad, |
|
|
|
ScalingBehavior.Crop, |
|
|
|
//ScalingBehavior.Crop,
|
|
|
|
//ScalingBehavior.Stretch
|
|
|
|
//ScalingBehavior.Stretch
|
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
@ -158,8 +158,8 @@ public class TranscodingTests |
|
|
|
// // // //
|
|
|
|
// // // //
|
|
|
|
// new("mpeg2video", "yuv420p"),
|
|
|
|
// new("mpeg2video", "yuv420p"),
|
|
|
|
// //
|
|
|
|
// //
|
|
|
|
new InputFormat("libx265", "yuv420p") |
|
|
|
new InputFormat("libx265", "yuv420p"), |
|
|
|
// new("libx265", "yuv420p10le")
|
|
|
|
new InputFormat("libx265", "yuv420p10le") |
|
|
|
//
|
|
|
|
//
|
|
|
|
// new("mpeg4", "yuv420p"),
|
|
|
|
// new("mpeg4", "yuv420p"),
|
|
|
|
//
|
|
|
|
//
|
|
|
|
@ -184,8 +184,8 @@ public class TranscodingTests |
|
|
|
|
|
|
|
|
|
|
|
public static FFmpegProfileBitDepth[] BitDepths = |
|
|
|
public static FFmpegProfileBitDepth[] BitDepths = |
|
|
|
[ |
|
|
|
[ |
|
|
|
FFmpegProfileBitDepth.EightBit |
|
|
|
FFmpegProfileBitDepth.EightBit, |
|
|
|
//FFmpegProfileBitDepth.TenBit
|
|
|
|
FFmpegProfileBitDepth.TenBit |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
public static FFmpegProfileVideoFormat[] VideoFormats = |
|
|
|
public static FFmpegProfileVideoFormat[] VideoFormats = |
|
|
|
@ -198,13 +198,20 @@ public class TranscodingTests |
|
|
|
public static HardwareAccelerationKind[] TestAccelerations = |
|
|
|
public static HardwareAccelerationKind[] TestAccelerations = |
|
|
|
[ |
|
|
|
[ |
|
|
|
HardwareAccelerationKind.None, |
|
|
|
HardwareAccelerationKind.None, |
|
|
|
HardwareAccelerationKind.Nvenc, |
|
|
|
//HardwareAccelerationKind.Nvenc,
|
|
|
|
//HardwareAccelerationKind.Vaapi,
|
|
|
|
HardwareAccelerationKind.Vaapi, |
|
|
|
HardwareAccelerationKind.Qsv, |
|
|
|
//HardwareAccelerationKind.Qsv,
|
|
|
|
// HardwareAccelerationKind.VideoToolbox,
|
|
|
|
// HardwareAccelerationKind.VideoToolbox,
|
|
|
|
// HardwareAccelerationKind.Amf
|
|
|
|
// HardwareAccelerationKind.Amf
|
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static StreamingMode[] StreamingModes = |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
StreamingMode.TransportStream, |
|
|
|
|
|
|
|
//StreamingMode.HttpLiveStreamingSegmenter,
|
|
|
|
|
|
|
|
StreamingMode.HttpLiveStreamingSegmenterV2 |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
public static string[] FilesToTest => [string.Empty]; |
|
|
|
public static string[] FilesToTest => [string.Empty]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -220,7 +227,9 @@ public class TranscodingTests |
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.VideoFormats))] |
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.VideoFormats))] |
|
|
|
FFmpegProfileVideoFormat profileVideoFormat, |
|
|
|
FFmpegProfileVideoFormat profileVideoFormat, |
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.TestAccelerations))] |
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.TestAccelerations))] |
|
|
|
HardwareAccelerationKind profileAcceleration) |
|
|
|
HardwareAccelerationKind profileAcceleration, |
|
|
|
|
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.StreamingModes))] |
|
|
|
|
|
|
|
StreamingMode streamingMode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var localFileSystem = new LocalFileSystem( |
|
|
|
var localFileSystem = new LocalFileSystem( |
|
|
|
Substitute.For<IClient>(), |
|
|
|
Substitute.For<IClient>(), |
|
|
|
@ -271,19 +280,15 @@ public class TranscodingTests |
|
|
|
DeinterlaceVideo = true, |
|
|
|
DeinterlaceVideo = true, |
|
|
|
BitDepth = profileBitDepth |
|
|
|
BitDepth = profileBitDepth |
|
|
|
}, |
|
|
|
}, |
|
|
|
StreamingMode = StreamingMode.TransportStream, |
|
|
|
StreamingMode = streamingMode, |
|
|
|
SubtitleMode = ChannelSubtitleMode.None |
|
|
|
SubtitleMode = ChannelSubtitleMode.None |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
string file = Path.Combine(TestContext.CurrentContext.TestDirectory, Path.Combine("Resources", "song.mp3")); |
|
|
|
string file = Path.Combine(TestContext.CurrentContext.TestDirectory, Path.Combine("Resources", "song.mp3")); |
|
|
|
var songVersion = new MediaVersion |
|
|
|
var songVersion = new MediaVersion |
|
|
|
{ |
|
|
|
{ |
|
|
|
MediaFiles = new List<MediaFile> |
|
|
|
MediaFiles = [new MediaFile { Path = file }], |
|
|
|
{ |
|
|
|
Streams = [] |
|
|
|
new() { Path = file } |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Streams = new List<MediaStream>() |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var song = new Song |
|
|
|
var song = new Song |
|
|
|
@ -294,6 +299,7 @@ public class TranscodingTests |
|
|
|
{ |
|
|
|
{ |
|
|
|
Title = "Song Title", |
|
|
|
Title = "Song Title", |
|
|
|
Artists = ["Song Artist"], |
|
|
|
Artists = ["Song Artist"], |
|
|
|
|
|
|
|
AlbumArtists = [], |
|
|
|
Artwork = [] |
|
|
|
Artwork = [] |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
], |
|
|
|
@ -378,6 +384,7 @@ public class TranscodingTests |
|
|
|
profileAcceleration, |
|
|
|
profileAcceleration, |
|
|
|
VaapiDriver.RadeonSI, |
|
|
|
VaapiDriver.RadeonSI, |
|
|
|
localStatisticsProvider, |
|
|
|
localStatisticsProvider, |
|
|
|
|
|
|
|
streamingMode, |
|
|
|
() => videoVersion); |
|
|
|
() => videoVersion); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -405,7 +412,9 @@ public class TranscodingTests |
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.VideoFormats))] |
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.VideoFormats))] |
|
|
|
FFmpegProfileVideoFormat profileVideoFormat, |
|
|
|
FFmpegProfileVideoFormat profileVideoFormat, |
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.TestAccelerations))] |
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.TestAccelerations))] |
|
|
|
HardwareAccelerationKind profileAcceleration) |
|
|
|
HardwareAccelerationKind profileAcceleration, |
|
|
|
|
|
|
|
[ValueSource(typeof(TestData), nameof(TestData.StreamingModes))] |
|
|
|
|
|
|
|
StreamingMode streamingMode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string file = fileToTest; |
|
|
|
string file = fileToTest; |
|
|
|
if (string.IsNullOrWhiteSpace(file)) |
|
|
|
if (string.IsNullOrWhiteSpace(file)) |
|
|
|
@ -613,7 +622,7 @@ public class TranscodingTests |
|
|
|
BitDepth = profileBitDepth, |
|
|
|
BitDepth = profileBitDepth, |
|
|
|
ScalingBehavior = scalingBehavior |
|
|
|
ScalingBehavior = scalingBehavior |
|
|
|
}, |
|
|
|
}, |
|
|
|
StreamingMode = StreamingMode.TransportStream, |
|
|
|
StreamingMode = streamingMode, |
|
|
|
SubtitleMode = subtitleMode |
|
|
|
SubtitleMode = subtitleMode |
|
|
|
}, |
|
|
|
}, |
|
|
|
v, |
|
|
|
v, |
|
|
|
@ -652,6 +661,7 @@ public class TranscodingTests |
|
|
|
profileAcceleration, |
|
|
|
profileAcceleration, |
|
|
|
VaapiDriver.RadeonSI, |
|
|
|
VaapiDriver.RadeonSI, |
|
|
|
localStatisticsProvider, |
|
|
|
localStatisticsProvider, |
|
|
|
|
|
|
|
streamingMode, |
|
|
|
() => v); |
|
|
|
() => v); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -898,6 +908,7 @@ public class TranscodingTests |
|
|
|
HardwareAccelerationKind profileAcceleration, |
|
|
|
HardwareAccelerationKind profileAcceleration, |
|
|
|
VaapiDriver vaapiDriver, |
|
|
|
VaapiDriver vaapiDriver, |
|
|
|
ILocalStatisticsProvider localStatisticsProvider, |
|
|
|
ILocalStatisticsProvider localStatisticsProvider, |
|
|
|
|
|
|
|
StreamingMode streamingMode, |
|
|
|
Func<MediaVersion> getFinalMediaVersion) |
|
|
|
Func<MediaVersion> getFinalMediaVersion) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string[] unsupportedMessages = |
|
|
|
string[] unsupportedMessages = |
|
|
|
@ -994,8 +1005,14 @@ public class TranscodingTests |
|
|
|
foreach (MediaStream videoStream in v.Streams.Filter(s => s.MediaStreamKind == MediaStreamKind.Video)) |
|
|
|
foreach (MediaStream videoStream in v.Streams.Filter(s => s.MediaStreamKind == MediaStreamKind.Video)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// verify pixel format
|
|
|
|
// verify pixel format
|
|
|
|
videoStream.PixelFormat.Should().Be( |
|
|
|
string expectedPixelFormat = (profileBitDepth, streamingMode) switch |
|
|
|
profileBitDepth == FFmpegProfileBitDepth.TenBit ? PixelFormat.YUV420P10LE : PixelFormat.YUV420P); |
|
|
|
{ |
|
|
|
|
|
|
|
//(FFmpegProfileBitDepth.TenBit, StreamingMode.HttpLiveStreamingSegmenterV2) => PixelFormat.RGB555LE,
|
|
|
|
|
|
|
|
(FFmpegProfileBitDepth.TenBit, _) => PixelFormat.YUV420P10LE, |
|
|
|
|
|
|
|
_ => PixelFormat.YUV420P |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
videoStream.PixelFormat.Should().Be(expectedPixelFormat); |
|
|
|
|
|
|
|
|
|
|
|
// verify colors
|
|
|
|
// verify colors
|
|
|
|
var colorParams = new ColorParams( |
|
|
|
var colorParams = new ColorParams( |
|
|
|
@ -1007,9 +1024,11 @@ public class TranscodingTests |
|
|
|
// AMF doesn't seem to set this metadata properly
|
|
|
|
// AMF doesn't seem to set this metadata properly
|
|
|
|
// MPEG2Video doesn't always seem to set this properly
|
|
|
|
// MPEG2Video doesn't always seem to set this properly
|
|
|
|
// RADEONSI driver doesn't set this properly
|
|
|
|
// RADEONSI driver doesn't set this properly
|
|
|
|
|
|
|
|
// NUT doesn't set this properly
|
|
|
|
if (profileAcceleration != HardwareAccelerationKind.Amf && |
|
|
|
if (profileAcceleration != HardwareAccelerationKind.Amf && |
|
|
|
profileVideoFormat != FFmpegProfileVideoFormat.Mpeg2Video && |
|
|
|
profileVideoFormat != FFmpegProfileVideoFormat.Mpeg2Video && |
|
|
|
(profileAcceleration != HardwareAccelerationKind.Vaapi || vaapiDriver != VaapiDriver.RadeonSI)) |
|
|
|
(profileAcceleration != HardwareAccelerationKind.Vaapi || vaapiDriver != VaapiDriver.RadeonSI) && |
|
|
|
|
|
|
|
streamingMode != StreamingMode.HttpLiveStreamingSegmenterV2) |
|
|
|
{ |
|
|
|
{ |
|
|
|
colorParams.IsBt709.Should().BeTrue($"{colorParams}"); |
|
|
|
colorParams.IsBt709.Should().BeTrue($"{colorParams}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|