Jump to content

FrameGrabber.Dll usage and developement


UEZ
 Share

Recommended Posts

It's written in VScript. That's my version of AutoIt. It has pretty much the same syntax as AutoIt, but has true compiler. It's what I wanted to do with AutoIt while being active in development. Anyway, not to repeat myself, some limited fuckers had different ideas.
Oh, and Jon doesn't want me to talk about my work on AutoIt on the forums, so that's about all the info I'm willing to share.

Not all codecs support frame count format, particularly those that handle streaming video formats, because streaming is done in time intervals, and not in frames. I can explain the algo if you want, the code can obviously be written in AutoIt.
We are going off-topic here, so create new thread somewhere if you want to go further. No PMs please.

Link and example: FrameGrabber.dll 

What about my question regarding returning a bitmap handle or bitmap data rather than saving the grabbed frame to disk?

Actually I would talk about VScript because I'm curious but Jon doesn't want it but can you show me the code please? You said it is similar to AU3 code. I want to understand how you did it.

 

Thanks.

 

 

 

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Nope, wrong forum section. Maybe this topic will be moved to "Developer Chat" section.

Afterwards will be see...

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

It uses IVMRWindowlessControl interface, particularly GetCurrentImage method. Unlike other similar methods from other interfaces, this one succeeds regardless of possible hardware acceleration.

The problem with DirectShow is plethora of deprecated interfaces, that should no longer be used. That's why it's very important not to use such interfaces for forward compatibility.
GetCurrentImage gets 32-bit DIB bitmap. To answer your question about whether bitmap data could be returned - yes. Last step of this version of frame grabber is simple prepending BMP header to that DIB and writing all that to disk.
Complete description of the code is:

  1. Create IGraphBuilder interface object - by calling ObjCreateInterface passing CLSID_FilterGraph and IID_IGraphBuilder
  2. Create IBaseFilter (Video Mixing Renderer here) object - by calling ObjCreateInterface passing CLSID_VideoMixingRenderer and IID_IBaseFilter
  3. Add the VMR to the filter graph - by calling IGraphBuilder.AddFilter(IBaseFilter, "Your name of this filter in the graph")
  4. Query VMR for IVMRFilterConfig - by calling ObjCreateInterface passing IBaseFilter (VMR) object and IID_IVMRFilterConfig
  5. Set rendering mode to VMRMode_Windowless - by calling IVMRFilterConfig.SetRenderingMode(VMRMode_Windowless) - This is super important step!
  6. Query VMR for IVMRWindowlessControl - by calling ObjCreateInterface passing IBaseFilter (VMR) object and IID_IVMRWindowlessControl
  7. Assign the rendering window (desktop one) - by calling IVMRWindowlessControl.SetVideoClippingWindow(handle to the desktop window)
  8. Render video file - by calling IGraphBuilder.RenderFile(video file)
  9. Query IGraphBuilder for IBasicAudio, IMediaControl, IMediaSeeking and IMediaEvent interfaces - by calling ObjCreateInterface passing IGraphBuilder object and IID_IBasicAudio, then IID_IMediaControl, IID_IMediaSeeking and finally IID_IMediaEvent
  10. Call  IBasicAudio.put_Volume(-10000) to mute the video (just in case)
  11. Call IMediaSeeking.SetPositions(startTime, AM_SEEKING_AbsolutePositioning, endTime, AM_SEEKING_AbsolutePositioning)
  12. Run the graph - play video - by calling IMediaControl.Run()
  13. Wait until rendering stops - by calling IMediaEvent.WaitForCompletion(INFINITE,  ...)
  14. Finally grab the frame - by calling IVMRWindowlessControl.GetCurrentImage(pDIB)
  15. ...Do whatever with it (I'm writing it to the disk to a BMP file)
  16. Call CoTaskMemFree on pDIB

Simple right? Yes it is, the most boring and tedious is to write interfaces description strings, after that it's pure fun.

If you want to limit yourself to AVI files only then it might be good idea to use AVIFile..., AVIStream... functions from avifil32.dll for simplicity (if you would find that simple).

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Thanks for the answer and pseudo code. I need to dig first in how to use those interfaces and then let's see.

I will revert when I understood the object stuff and have any question. This can take a while (I'm over 40 ;))

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Do you suggest that trancexx is youngest than you ?

Would you have some other interesting informations ? :D

​Afaik, yes she is younger than me.

I'm not an interesting person, rather boring. ;)

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 3 weeks later...

Maybe this should be in the chat forum, (mods, move as required).

The mention of a true autoit compiler piqued my interest, now, I know you (trancex) can`t provide any details about this here, but some speed comparisons (a youtube video would be really nice) would be interesting to see.

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...