/// <summary> /// Gets label for given video quality and framerate, as displayed on YouTube. /// </summary> public static string GetVideoQualityLabel(this VideoQuality videoQuality, int framerate) { framerate.GuardNotNegative(nameof(framerate)); // Framerate appears only if it's above 30 if (framerate <= 30) { return(videoQuality.GetVideoQualityLabel()); } // YouTube always shows framerate as 60, no matter what it is return(videoQuality.GetVideoQualityLabel() + "60"); }
/// <summary> /// Gets label for given video quality and framerate, as displayed on YouTube. /// </summary> public static string GetVideoQualityLabel(this VideoQuality videoQuality, int framerate) { framerate.GuardNotNegative(nameof(framerate)); // Framerate appears only if it's above 30 if (framerate <= 30) { return(videoQuality.GetVideoQualityLabel()); } // YouTube rounds framerate to nearest next ten var framerateRounded = (int)Math.Ceiling(framerate / 10.0) * 10; return(videoQuality.GetVideoQualityLabel() + framerateRounded); }
public void Extensions_VideoQuality_GetVideoQualityLabel_Test(VideoQuality quality, [Values(24, 30, 60)] int framerate) { var label = quality.GetVideoQualityLabel(framerate); Assert.That(label, Is.Not.Null.Or.Empty); }
/// <summary /> public MuxedStreamInfo(int itag, string url, long size) : base(itag, url, size) { AudioEncoding = GetAudioEncoding(itag); VideoEncoding = GetVideoEncoding(itag); VideoQuality = GetVideoQuality(itag); VideoQualityLabel = VideoQuality.GetVideoQualityLabel(); }
/// <summary /> public VideoStreamInfo(int itag, string url, long size, long bitrate, VideoResolution resolution, int framerate) : base(itag, url, size) { Bitrate = bitrate.EnsureNotNegative(nameof(bitrate)); VideoEncoding = GetVideoEncoding(itag); VideoQuality = GetVideoQuality(itag); Resolution = resolution; Framerate = framerate.EnsureNotNegative(nameof(framerate)); VideoQualityLabel = VideoQuality.GetVideoQualityLabel(framerate); }