Capture Flash Video

.NET Edition of the F-IN-BOX
pchen
Posts: 5
Joined: Fri Oct 12, 2007 5:39 am

Capture Flash Video

Postby pchen » Sat Apr 19, 2008 6:58 pm

Is there a way capture a frame from the running flash video? Do you have any sample code?

Thanks,

Ping

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Sat Apr 19, 2008 9:25 pm

Thank you for your question.

Yes, it's possible. Just create f_in_box__control with TransparentMode = true and handle OnFlashPaint event, something like that:

Code: Select all

[DllImport("Kernel32.dll", EntryPoint = "RtlMoveMemory")]
private static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);

private void flashControl1_OnFlashPaint(object sender, IntPtr pPixelPointer)
{
     BitmapData bmd = bitmap1.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);

      int StrideSize = width * 4;

      for (int i = 0; i < height; i++)
      {
        IntPtr s = new IntPtr(pPixelPointer.ToInt32()+StrideSize * i);
        IntPtr d = new IntPtr(bmd.Scan0.ToInt32() + (StrideSize * (575 - i)));
        CopyMemory(d, s, StrideSize);
      }

      bitmap1.UnlockBits(bmd);
    }
}
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

pchen
Posts: 5
Joined: Fri Oct 12, 2007 5:39 am

Postby pchen » Sun Apr 20, 2008 7:02 pm

I also find that I can use the following code.

Bitmap frame = this.f_in_box__control1.GetBitmap();

But for capture every frame, your solution is better.

Many Thanks.

Ping


Return to “.NET Edition”

Who is online

Users browsing this forum: No registered users and 6 guests

cron