/// <summary> /// Creates new video codec id from 4-character string. /// </summary> /// <param name="codecName">4-character string codec name.</param> /// <returns>Video codec.</returns> public static VideoCodec FromName(string codecName) { if (codecName.Length != CODEC_NAME_LENGTH) { throw new Exception("Codec name is 4-characters long!"); } return(VideoCodec.FromName(codecName[0], codecName[1], codecName[2], codecName[3])); }
/// <summary> /// Creates new video writer. /// </summary> /// <param name="fileName">Video file name.</param> /// <param name="frameSize">Video frame size.</param> /// <param name="fps">Specifies the number of frames per second.</param> /// <param name="isColor">Specifies whether the image is color image (3 channels) or grayscale image (one channel).</param> /// <param name="videoCodec">Specifies used codec for video encoding.</param> public VideoWriter(string fileName, Size frameSize, float fps, bool isColor, VideoCodec videoCodec) { this.CanSeek = false; this.IsLiveStream = true; this.OutputFileName = fileName; this.ColorFrames = isColor; this.Codec = videoCodec; this.FrameSize = frameSize; this.FrameRate = fps; this.Open(); //to enable property change }