thanks for your help. You're right, when I disable trySeeking, it correctly reads and displays every frame that I give as an argument to mmread. Unfortunately, this makes the function too slow for me, so I have to find another way. Is it possible that mmread with trySeeking=true sometimes does not read the correct frame as specified by the framenumber?
I looked into the processFrame option, and I'm sorry, I don't really understand how to use it - would you offer some more advice on that? Am I expected to adjust processFrame.m to my needs, e.g. where it says "% now do something with the data..."? However, I also get my original problem (which is that the displayed image does not correspond to the framenumber) when I use processFrame.m without changing it:
The displayed image is changing roughly every 10-30 frames, and then for the next 10-30 frames the displayed image does not change again.
Some other observations that might help to figure out what is going on:
- In the above code which includes "processframe", I sometimes
also get Matlabs Out Of Memory Error.
- Without using "processframe", the video-structure returned by mmread does not contain any image-data, i.e., video.frames is a 1x0 structure array.
I'm sure I'm doing something wrong here, especially with processframe - any help would be highly appreciated.
thanks for this code; that seems to solve my problems of working with mpeg2 movies in Matlab.
I get the same Warning message as Francesca pointed out above:
Warning: In the directory "D:\common\matlab\_MatlabCentralToolboxes\mmread",
mexDDGrab.mexw32 now shadows mexDDGrab.dll.
but I can open my mpg-file. Is this anything to worry about?
In addition, I have another problem: I am stepping through a long mpeg2 movie, reading and displaying only one frame at a time, using mmread('mymovie.mpg',framenumber). However, when I successively increase framenumber by 1, it seems that mmread keeps retrieving the same image (there is now change visible in the displayed image). Only when doing bigger jumps of sometimes 10 or 50 frames, I really get the new frame.
Do you have any idea what's going on here?
Thanks for your help, and again for mmread as a whole!