View Full Version : eFrameReady event for MediaStreamSink

March 2, 2016, 20:04:27

I have found some other questions related to this problem but I was not able to implement the solutions. My main objective is to be able to display the frames (for now using the grabber listener and eFrameReady event) while they are saved to an avi file with the MediaStreamSink. The problem is that the eFrameReady event seems not to be emitted when using the MediaStreamSink.

What would be the proper way to achieve that? Would it be to use the FrameHandlerSink and save each images to an avi file, or to use the MediaStreamSink to save, and to somehow trigger or output the frame data so that they can be displayed?

For the latter option, it seems that the FrameFilter could be used to copy a frame, but I do not know/understand how to write the proper Filter, and how to send the copied frame to the listener.


Stefan Geissler
March 3, 2016, 16:18:56
Hello Olivier

Callback and AVI Capture is not possible with IC Imaging Control at the same point of time. But there is solution for this at

However, this sample is for saving images.

Another approach is using the OverlayUpdate event of the Grabberlistener, which is called even on AVI Capture.

However, I wonder, why you need such a complicated approach showing the live stream while AVI Capture, since the live stream can be displayed by default during AVI Capture. Simply have a look into the sample provided with IC Imaging Control.

March 3, 2016, 16:53:48
Thank you Stefan for your fast reply.

I need access to the frame data when acquiring an AVI capture because we are doing live image processing while recording (and not only displaying the data). For the processing (and the display), we use OpenCV. Everything works perfectly fine with the FrameHandlerSink, but not with the MediaStreamSink, since the processing is done in the eFrameReady event.

I will try to get the frame data from inside the OverlayCallback event.

Stefan Geissler
March 3, 2016, 17:00:58
ok, I see

what about using the standard callback and save the images from there into an AVI file? I am sure there are libraries fort his.

Also, have a look on the Overlay Update Event handler, may be you can do the image processing in there too, instead of frameReady

Or... as shown in the Image and AVI Capture sample, you use a frame filter for image processing! So you simply create a new frame filter with the IC Project wizard and do the image processing in there. Please look at

March 23, 2016, 19:41:32
Thank you again for your answers. I've finally decided to always use the eFrameReady event, and to save the frame to an avi file using the OpenCV VideoWriter utility.

Stefan Geissler
March 24, 2016, 07:52:21
Hi Olivier

That is an interesting solution. Is the OpenCV DirectSow or VideoForWindows based?

March 25, 2016, 18:42:51
From the docs (http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html#videowri ter-videowriter), I think both are/can be used. The codec can also be specified as the FOURCC code.