public Bitmap GetSubsequentPosition(int framePosition) { IntPtr dib = Avi32.AVIStreamGetFrame(new IntPtr(getFrameObject), framePosition); Avi32.BITMAPINFOHEADER bih = new Avi32.BITMAPINFOHEADER(); bih = (Avi32.BITMAPINFOHEADER)Marshal.PtrToStructure(dib, bih.GetType()); Bitmap bmp = new Bitmap(this.width, this.height, PixelFormat.Format24bppRgb); BitmapData bmData = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); int srcStride = bmData.Stride; int dstStride = bmData.Stride; int dst = bmData.Scan0.ToInt32() + dstStride * (height - 1); int src = dib.ToInt32() + Marshal.SizeOf(typeof(Avi32.BITMAPINFOHEADER)); for (int y = 0; y < height; y++) { Avi32.memcpy(dst, src, srcStride); dst -= dstStride; src += srcStride; } bmp.UnlockBits(bmData); return bmp; }