Click to See Complete Forum and Search --> : Coverting a Frame of AVI to BMP


Naweed Akram
October 2nd, 1999, 02:22 AM
Given an AVI File and a Framr No in that, How can I convert and save that Frame No to a BMP Format?

Aaron Young
October 28th, 1999, 11:14 PM
Here's an old bit of code I created a while back, which creates a bitmap of the Frames in an AVI/MOV File using the Active Movie Control and a Picturebox..

private Declare Function GetDC Lib "user32" (byval hwnd as Long) as Long
private Declare Function BitBlt Lib "gdi32" (byval hDestDC as Long, byval x as Long, byval y as Long, byval nWidth as Long, byval nHeight as Long, byval hSrcDC as Long, byval xSrc as Long, byval ySrc as Long, byval dwRop as Long) as Long
private Const SRCCOPY = &HCC0020

private Sub Command1_Click()
Dim I as Integer
Dim lDC as Long
lDC = GetDC(amov.hwnd)
Picture1.AutoRedraw = true
for I = 0 to amov.Duration
amov.CurrentPosition = I
Call BitBlt(Picture1.hdc, I * amov.ImageSourceWidth, 0, amov.ImageSourceWidth, amov.ImageSourceHeight - 5, lDC, 0, 0, SRCCOPY)
next
Call SavePicture(Picture1.Image, "C:\AVIFrames.bmp")
End Sub

private Sub Form_Load()
Picture1.ScaleMode = vbPixels
Picture1.Width = ScaleX(amov.ImageSourceWidth * (amov.Duration + 1), vbPixels, vbTwips)
Picture1.Height = ScaleY(amov.ImageSourceHeight - 5, vbPixels, vbTwips)
End Sub





Aaron Young
Analyst Programmer
adyoung@win.bright.net
aarony@redwingsoftware.com