LEADTOOLS Support
Multimedia
Multimedia SDK FAQ
How can I get access to each frame from a video?
#1
Posted
:
Tuesday, April 18, 2017 8:58:09 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
An updated example which shows how to apply a Multimedia Filter can be found here: https://www.leadtools.co...ter-to-a-video-file.htmlEach frame within a video stream can be accessed through the
LEAD Video Callback filter. This is a video processing filter available with the Multimedia SDK. For more information on how to use a video processor, please check out
How to apply audio/video effects using the Multimedia SDK?It is possible to use multiple instances of this filter within the same graph if necessary. Each callback should process the data as quickly as possible before returning. Getting the different instances of the video callback filter to attach different callback implementations can be done by changing the integer provided in the GetSubObject() method. For example, if you added the video callback filter, the rotate filter, and another video callback filter, you would pass CaptureObject.SelVideoProcessor and CaptureObject.SelVideoProcessor + 2 respectively to get the two video callback filters.
Here is sample code illustrating how to add it and assign the user callback to be used. Here is the implementation of the callback method:
Code:
class LMVMyUserCallback : ILMVUserCallback
{
public void ReceiveProc(int pData, int lWidth, int lHeight, int lBitCount, int lSize, int bTopDown)
{
RasterViewPerspective viewPerspective;
if (bTopDown == 1)
viewPerspective = RasterViewPerspective.TopLeft;
else
viewPerspective = RasterViewPerspective.BottomLeft;
RasterImage img = new RasterImage(
RasterMemoryFlags.User,
lWidth,
lHeight,
lBitCount,
RasterByteOrder.Bgr,
viewPerspective,
null,
IntPtr.Zero,
0);
img.SetUserData(new IntPtr(pData), lSize);
// TODO: Image Processing Here
}
}
And where it is used:
Code:
int filterIndex = 0;
myCaptureCtrl.SelectedVideoProcessors.Add(myCaptureCtrl.VideoProcessors.Callback);
lmvCallback = (LMVCallback)myCaptureCtrl.GetSubObject(CaptureObject.SelVideoProcessor + filterIndex);
lmvMyUserCallback = new LMVMyUserCallback();
lmvCallback.ReceiveProcObj = lmvMyUserCallback;
There are shipping code examples in the SDK here:
Edited by moderator Wednesday, December 27, 2023 4:57:57 PM(UTC)
| Reason: Not specified
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Multimedia
Multimedia SDK FAQ
How can I get access to each frame from a video?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.