Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
extract frames from video files
do you know a free lib or a way to do that with qm using existing libs ?
i would like to extract a few frames for a preview picture.

In MSDN library I found AVIStreamGetFrame, but I am not familiar with AVI functions and cannot give an example.
i found a commercial ocx ...

what does a minus mean when returning a handle ?

Copy      Help
typelib VIDEOEDITLib {F2BD1C8B-41F5-4842-AC48-3B94E1F85FCE} 1.0
VIDEOEDITLib.VideoEdit a._create

str v="D:\filme\Everybody.Hates.Chris.S01E01.mpg"
int d=a.GetFileDuration(v)
int fr=a.GetFileFrameRate(v)

int allframes=fr*d
int step= d/12
str outfile
;out a.GetFileFrameRate(v)
;a.GetFrameBySize( v 6 "c:\newbitmap.bmp" 240 180)
;out step

_i=step;int i
ARRAY(int) hbitmap.create(12)
rep 3
,hbitmap[i] = a.GetFrameBySize2HBitmap(v _i 240 180)
,;outfile.format("c:\test_%i.bmp" _i)
,;a.GetFrameBySize(v _i outfile 240 180)

out hbitmap[0]
Nothing, except if it is -1. Handles can be positive or negative numbers. 0 or -1 usually is invalid handle.
so getting '-1660612617' is nothing to worry about ?
its only an example (pressing run again and again for output - sometimes minus other times not, but ever a value)

do you have an example on how to build one picture from mutliple sources by
using GflAx DLL ?

i try to build a preview picture of my captured frames.
Quote:so getting '-1660612617' is nothing to worry about
Don't worry.

Quote:do you have an example on how to build one picture from mutliple sources by
using GflAx DLL
No. I would try to use NewBitmap and DrawImage methods.
sorry to bother again, but how do i pass my hbitmap[i] (videoframe)
to GflAx ?

you used
stdole.IPicture p=g.GetPicture in another example, but that was for icons.

please give me a one handle example.
It should be easy without GflAx. CreateCompatibleBitmap, GetDC, BitBlt, SaveBitmap, etc. You should find examples with these functions somewher in forum and in QM. Maybe I'll post example later.
oh yes, please teach me.
some things in mdsn and qm are not easy to understand unless you get the main concept.
Copy      Help
ARRAY(int) ab.create(2)
ab[0]=LoadPictureFile("$my qm$\Macro341.bmp" 0)
ab[1]=LoadPictureFile("$my qm$\Macro341 (2).bmp" 0)
int width(20) height(20)

;source dc
int dcs=CreateCompatibleDC(0)

;dest bitmap and dc
int dc0=GetDC(0)
int bm=CreateCompatibleBitmap(dc0 width*ab.len height)
ReleaseDC(0 dc0)
int dc=CreateCompatibleDC(0)
int oldbm=SelectObject(dc bm)

int i
for i 0 ab.len
,int oldbms=SelectObject(dcs ab[i])
,BitBlt(dc i*width 0 width height dcs 0 0 SRCCOPY)
,SelectObject(dcs oldbms)

SelectObject(dc oldbm)

for(i 0 ab.len) DeleteObject(ab[i])

SaveBitmap(bm "$desktop$\test.bmp")
run "$desktop$\test.bmp"

Forum Jump:

Users browsing this thread: 1 Guest(s)