Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, April 4, 2012 12:57:14 PM(UTC)

Groups: Registered
Posts: 5

I am adding a LEAD Video Text Overlay filter to Leadtools.Multimedia.PlayCtrl while the video is stopped at a given frame in the player. When I add the filter, the filter graph is automatically rebuilt and it sets the video stream at the beginning (the first frame of the video is now displayed in the video player). In order to display the frame that was displayed before the addition of the filter I set Leadtools.Multimedia.PlayCtrl.CurrentFramePosition to its original value and then call Leadtools.Multimedia.PlayCtrl.Pause() to execute the filter graph (otherwise it is not executed and the change of current frame is not reflected). Is there a better way to do it (because sometimes I will observe flicker due to the fact that the first frame is displayed then my original current frame is finally displayed)?
Here is my code (in VB.NET):

'Store the current frame before adding the LEAD Video Text Overlay filter to be able to reset the video to this frame after having added the filter.
 Dim currentFramePosition As Integer = VideoPlayControl.CurrentFramePosition

 Dim countTextOverlayFilters As Integer = VideoPlayControl.SelectedVideoProcessors.Count
'Modify the latest filter attached.
Dim textOverlayFilter As LMVTextOverlayLib.ILMVTextOverlay = TryCast(VideoPlayControl.GetSubObject(Leadtools.Multimedia.PlayObject.SelVideoProcessor + countTextOverlayFilters - 1), LMVTextOverlayLib.ILMVTextOverlay)
textOverlayFilter.EnableTextOverLay = True
 textOverlayFilter.EnableOutline = False 'Use just the text font to draw
textOverlayFilter.FontColor = 65535 'Yellow
textOverlayFilter.OverlayText = String.Format(".GCP_{0}", countTextOverlayFilters - 1) 'Set a single piece of text to display
 textOverlayFilter.XPos = 100
textOverlayFilter.YPos = 100
'Reset the frame value to what we had before the addition of the filter
VideoPlayControl.CurrentFramePosition = currentFramePosition

'This is needed because otherwise the filter graph is not executed right away and the first frame of the video is displayed instead of the current frame.


Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, April 5, 2012 7:27:31 AM(UTC)


Groups: Registered
Posts: 256

Your explanation is accurate and your solution of using the frame position is correct. The problem with flickering might not be easy to solve directly. You could try to hide the control while you re-position (, but I think that might produce a different kind of flicker.
There are other things you could try, such as taking a snapshot of the current frame and displaying it in a control such as our imaging RasterImageViewer or a picture box.

#3 Posted : Sunday, April 8, 2012 7:06:09 AM(UTC)


Groups: Registered
Posts: 256

There is also another approach that might solve it.
Instead of adding the filter midway through playback, you can add the filter from the beginning and disable it, then re-enable it whenever you want. That will minimize the flickering and will save you the trouble of saving the current frame and repositioning.

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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.059 seconds.