/// <summary>
        /// Converts most fitting streams for the specified video ID.
        /// </summary>
        public async Task ConvertStreamsAsync(
            VideoId videoId,
            string outputFilePath,
            IProgress <double>?progress         = null,
            CancellationToken cancellationToken = default)
        {
            var options = new ConversionOptionsBuilder(outputFilePath).Build();

            await ConvertStreamsAsync(
                videoId,
                options,
                progress,
                cancellationToken
                );
        }
예제 #2
0
        public async Task I_can_download_a_video_with_a_custom_target_framerate()
        {
            // Arrange
            var outputFilePath = _tempOutputFixture.GetTempFilePath();
            var converter      = new YoutubeClient().Videos.Streams.GetConverter(_ffmpegFixture.FilePath);

            var options = new ConversionOptionsBuilder(outputFilePath)
                          .SetFormat("mp4")
                          .SetTargetFramerate(new Framerate(15))
                          .SetPreset(EncoderPreset.UltraFast)
                          .Build();

            // Act
            await converter.ConvertStreamsAsync("AI7ULzgf8RU", options);

            var fileInfo = new FileInfo(outputFilePath);

            // Assert
            fileInfo.Exists.Should().BeTrue();
            fileInfo.Length.Should().BeGreaterThan(0);

            // No real way to assert framerate...
        }