Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
extract frames from video files
#1
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.

thanks
pi
#2
In MSDN library I found AVIStreamGetFrame, but I am not familiar with AVI functions and cannot give an example.
#3
i found a commercial ocx ...
http://www.viscomsoft.com/products/videoeditgold/

what does a minus mean when returning a handle ?

Macro11
Code:
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)
,;of[i]=outfile
,_i=_i+step;i=i+1

out hbitmap[0]
pi
#4
Nothing, except if it is -1. Handles can be positive or negative numbers. 0 or -1 usually is invalid handle.
#5
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.
pi
#6
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.
#7
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.
:oops:
pi
#8
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.
#9
oh yes, please teach me.
some things in mdsn and qm are not easy to understand unless you get the main concept.
pi
#10
Code:
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)
DeleteDC(dc)
DeleteDC(dcs)

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)