public void BasicTest(bool aspectRatio) { string filePath = Path.Combine(_testVideoDataPath, "avc.mp4"); var options = new AVDecoderOptions { FrameSizeOptions = new FrameSizeOptions() { TargetFrameSize = new Size(100, 100), PreserveAspectRation = aspectRatio, }, }; _configuration.ImageFormatsManager.SetDecoder(Mp4Format.Instance, new Mp4Decoder(options)); using var inputStream = File.OpenRead(filePath); using var image = Image.Load(_configuration, inputStream); if (!aspectRatio) { Assert.Equal(100, image.Width); Assert.Equal(100, image.Height); } else { Assert.Equal(100, image.Width); Assert.Equal(56, image.Height); } }
public void BlackFrameFilterEnabledTest() { string filePath = Path.Combine(_testVideoDataPath, "black_frame.mp4"); var options = new AVDecoderOptions { BlackFilterOptions = new BlackFrameFilterOptions() }; _configuration.ImageFormatsManager.SetDecoder(Mp4Format.Instance, new Mp4Decoder(options)); using var inputStream = File.OpenRead(filePath); using var image = Image.Load <Rgb24>(_configuration, inputStream); Assert.NotEqual(Color.Black.ToPixel <Rgb24>(), image[0, 0]); }