public static void Main()
 {
     using (var encoder = VP8Codec.CreateEncoder())
     {
         Console.WriteLine(encoder.Encode());
     }
 }
示例#2
0
        public unsafe void DecodeKeyFrame()
        {
            string hexKeyFrame = File.ReadAllText("testpattern_keyframe.vp8");

            byte[] buffer = HexStr.ParseHexStr(hexKeyFrame.Trim());

            VP8Codec vp8Codec = new VP8Codec();

            var rgbSamples = vp8Codec.DecodeVideo(buffer, VideoPixelFormatsEnum.I420, VideoCodecsEnum.VP8);

            Assert.Single(rgbSamples);

            var rgbSample = rgbSamples.First();

            fixed(byte *bmpPtr = rgbSample.Sample)
            {
                Bitmap bmp = new Bitmap((int)rgbSample.Width, (int)rgbSample.Height, (int)rgbSample.Width * 3, System.Drawing.Imaging.PixelFormat.Format24bppRgb, new IntPtr(bmpPtr));

                bmp.Save("decodekeyframe.bmp");
                bmp.Dispose();
            }
        }