예제 #1
0
        public void Should_Return_Software_Video_Filter(
            bool deinterlace,
            bool scale,
            bool pad,
            string expectedVideoFilter,
            string expectedVideoLabel)
        {
            FFmpegComplexFilterBuilder builder = new FFmpegComplexFilterBuilder()
                                                 .WithDeinterlace(deinterlace);

            if (scale)
            {
                builder = builder.WithScaling(new Resolution {
                    Width = 1920, Height = 1000
                });
            }

            if (pad)
            {
                builder = builder.WithBlackBars(new Resolution {
                    Width = 1920, Height = 1080
                });
            }

            Option <FFmpegComplexFilter> result = builder.Build(false, 0, 0, 0, 1, false);

            result.IsSome.Should().BeTrue();
            result.IfSome(
                filter =>
            {
                filter.ComplexFilter.Should().Be(expectedVideoFilter);
                filter.AudioLabel.Should().Be("0:1");
                filter.VideoLabel.Should().Be(expectedVideoLabel);
            });
        }
예제 #2
0
            public void Should_Return_VAAPI_Video_Filter(
                string codec,
                bool deinterlace,
                bool scale,
                bool pad,
                string expectedVideoFilter,
                string expectedVideoLabel)
            {
                FFmpegComplexFilterBuilder builder = new FFmpegComplexFilterBuilder()
                                                     .WithHardwareAcceleration(HardwareAccelerationKind.Vaapi)
                                                     .WithInputCodec(codec)
                                                     .WithDeinterlace(deinterlace);

                if (scale)
                {
                    builder = builder.WithScaling(new Resolution {
                        Width = 1920, Height = 1000
                    });
                }

                if (pad)
                {
                    builder = builder.WithBlackBars(new Resolution {
                        Width = 1920, Height = 1080
                    });
                }

                Option <FFmpegComplexFilter> result = builder.Build();

                result.IsSome.Should().BeTrue();
                result.IfSome(
                    filter =>
                {
                    filter.ComplexFilter.Should().Be(expectedVideoFilter);
                    filter.AudioLabel.Should().Be("0:a");
                    filter.VideoLabel.Should().Be(expectedVideoLabel);
                });
            }