Forum archive - WMP and VB6, is it possible to step forward or back frame by frame?

http://www.supermediastore.com/



Forum Archive Home -> Programming -> WMP and VB6, is it possible to step forward or back frame by frame?



WMP and VB6, is it possible to step forward or back frame by frame?

gadgetguy posted 2009 Mar 03 10:33
OK, I'm finally trying to do something that actually involves showing the video in my app. I can add the WMP control and get it to play my .avs ok, but I can't find any way to step through it one frame at a time. Is there a way to do this using the WMP control or can someone suggest a different control that will do what I want?
Thanks



IKnowNothing posted 2009 Mar 03 12:43
I don't think it's possible with the media player control.
As far as I can see there is no mention of frames etc. in any of the properties (either at design or runtime) the only reference you get is .duration and .position and they are seconds from start.

I theory you could get the frame rate and then modify .position by the duration of one frame but I'm not convinced that would be accurate enough. Might be worth a try though :-)

It might be worth having a look on MSDN or freevbcode.com

M



gadgetguy posted 2009 Mar 03 14:38
Thanks. I've been following links all day at MSDN without success. I found a reference to a .currentPositionTimecode property that is supposed to allow frame specific navigation, but it's not supported in my version of wmp.ocx and I can't find what version is supposed to support it.

I took a quick look at freevbcod.com and there are a couple apps that look promising, but Ill have to download and research to know for sure.



gll99 posted 2009 Mar 04 21:43
I did this a long time ago but... Try this which works for forward stepping

frmmain.WindowsMediaPlayer1.Controls.Step (1)

For anyone else who looks later I'll state the obvious:

In my example:
frmMain is the name of my form which holds the player control
WindowsMediaPlayer1 is the name of my player control

Although "Step" does not show up in the "Controls" options it is available.

Also of course you would probably want to issue a pause or stop before stepping
frmmain.WindowsMediaPlayer1.Controls.pause 'or stop

btw)
If you are using vb6, in VB under "View" click on "Object Browser" and then find the "WindowMediaPlayer" and snoop around. Also look at anything that looks like "IWMPControls" or anything that starts with IWMP" these are classes that contain more options that may be available to the programmer of the wmp control. For example under the Class "IWMPControls2" you will find the "Step" option and this is what it states:

:
Sub step(lStep As Long)
Member of WMPLibCtl.IWMPControls2
Advances the video one frame


Lots of little gems like that available in the "Object Browser" and you can use it to view any other objects available to your project.



gadgetguy posted 2009 Mar 04 22:08
Thanks, I'll give that a try tomorrow.


gadgetguy posted 2009 Mar 05 12:00
That works for stepping forward, but (-1) doesn't step backward, and according to here, [url] http://msdn.microsoft.com/en-us/library/bb262214(VS.85).aspx [/url], it should. So it's closer to allowing me to do what i want, but doesn't allow me to correct any mistakes...
But I do appreciate the help, thanks.



gll99 posted 2009 Mar 05 16:26
In my experience it only works for forward frame movement. I recall that someone had said that the (-1) worked for them but I had not tried it because I didn't need it in my app since I was doing frame by frame capture. I tested the frame back (-1) for you on my system and it didn't work for me either. Too bad MS changed the plugin frame reporting functions after v6.4 of the player.

btw) I'm using v10 of the player which one are you using? It's strange that the back (-1) is broken according to that MS link, it should work. It's possible this only works with the v11 of the wmp.dll.



gadgetguy posted 2009 Mar 06 11:35
I've got v10 also. I appreciate the help, but I'm starting to lose interest in this project anyway.

The idea was to step through a video to visually identify unique and repeat frames and build a movable grid to identify patterns. I've got several OTA captured HD TS files at 59.94 fps that I want to convert for DVD. They're identified as Interlaced, but the frames are all progressive. For the most part it's a simple 3:2 pattern, but the pattern shifts every so often because of signal drops. If I can identify the missing frames and insert repeats to solidify the pattern, then I can apply the proper selectevery() filter to return it to the original 23.976 without having to trim it into bunches of little bitty segments. What I've got works, but it's a pain to walk through 10000s of frames to build the grid which becomes too big to fit on the screen, so you can't see the breaks in the pattern anyway.



gll99 posted 2009 Mar 06 14:05
I know what you mean about losing interest. I have lots of partially completed projects in which I lost interest when I found something else to occupy my time and moved on.

I had wmp11 on my system but ran into a problem a while back. I thought it was caused by wmp11 so I rolled back to v10. It turned out that the problem was totally unrelated but just haven't bothered to re-install it. I might just for the heck of it one of these days. There must be some kind of conflict though because I noticed that the "Controls.fastReverse" and "Controls.fastForward" don't work either. I had to fudge those. I Googled the problem and it's happened to others but no one's posted anything useful so far.

It's not something I need right now but I hate loose ends.



JohnnyMalaria posted 2009 Mar 06 18:11
For WMP versions using DirectShow as the underlying framework, the ability to seek (of which stepping forward/backward is an example) depends upon the file reader filter for the specific video format. It has to expose the IMediaSeeking interface. Typically, variable rate video formats cannot seek - MPEG is a good example. It is because the frame start positions cannot be calculated unlike with formats where each frame is the same size (byte-wise).

Also, programming DirectShow things is a lesson in patience and the unexpected. The number of hurdles I have had to overcome/circumvent is not small. Often the cause is very obscure and not easily found in MSDN or easily resolved.



gadgetguy posted 2009 Mar 06 18:54
Programming anything in VB6 can be a lesson in patience and the unexpected, :lol: but I now only do it for fun, not profit, so I get bored easy. I don't think seeking is the issue since I'm feeding my video through DGIndex and AviSynth. I did try several different types of videos, including DV-AVI (type1 and type2) and uncompressed, and it wouldn't go backward for any of them.


gll99 posted 2009 Mar 06 20:00
I too putter in vb purely for pleasure. I started with mainframe languages at work then dabbled with Assembly on my first pc and so on.

The videos I tested were captured and compressed with ffdshow mpeg4 on my pc. I know they can frame back and forth because in vb I made a quick test app using the OLE container which lets you insert objects like media clips, pdf, excel sheets etc.... That imbedded player (mplay32.exe) has frame back and forward buttons as well as the fastforward and fastreverse options and they work well. The issue has to be with the wmp.dll plugin itself or some conflict in the way it's being accessed in vb.




Login/Register to our forum to be able to post here.








VSO Software ConvertXtoDVD lets you convert any video like AVI,MKV to DVD easily. More info or download trial!
About   Advertise   Forum Archive   RSS Feeds   Statistics