everwicked
17th September 2003, 16:27
Hello everybody,
I know this is not a directshow development forum but since AviSynth implements DirectShowSource and I am getting quite desperate with this problem, I came to ask for help in case someone knows.
For those of you that have not heard, I started development of vqstudio (http://www.everwicked.com/vqstudio), an application to ease objective video quality evaluation. So far, I have implemented frame grabbing and passing via VFW. As you all know, that is limited to AVI files so I wanted to extend functionality by enabling Directshow sources.
Coming down to the problem, just like AviSynth, my framework needs to be able to seek (random access) to a keyframe, grab it and deliver it to the metric for processing. Random access is required because a complex metric might request a previous or next frame so the processing cannot happen in a sequential way.
Before you ask why don't I use the files wrapped in an .avs script, that is not as efficient because the samples delivered will appear to be keyframes always while that's not the case in the original video.
I have been so far using this method to seek and grab:
- Build a graph
- Insert a Sample Grabber filter (the one provided with directx)
- Set the grabber to one shot mode
- Seek to the frame position requested (IMediaSeeking::SetPositions/AM_MEDIA_SEEKING_AbsolutePositioning is used for this)
- Play the graph and wait for it to finish through IMediaEvent::WaitForCompletion()
- Give away the result of the frame buffer
The problem here is that it makes the whole process very slow for some reason. To put down the numbers, in normal mode, the graph (with clock set to 0) will run at about 80 fps. Using this method, it runs at about 4-5fps.
I have came to the conclusion that this is because of the seeking (I also checked that the graph is paused, not stopped by the sample grabber). I tried to use Relative/Incremental Positioning as well without managing to get it to seek to the frame I wanted. I looked at the directshow docs again and again but no good.
So, the question is. Is there a better/faster method to seek/grab frames? Is RelativePositioning faster compared to AbsolutePositioning?
Also, I peaked at AviSynth's source for DirectShowSource class and I saw that it uses a custom SampleGrabber to get the frames off the video. Why is that? Or in other words, do you achieve faster seeking that way?
Any help would be appreciated.
I know this is not a directshow development forum but since AviSynth implements DirectShowSource and I am getting quite desperate with this problem, I came to ask for help in case someone knows.
For those of you that have not heard, I started development of vqstudio (http://www.everwicked.com/vqstudio), an application to ease objective video quality evaluation. So far, I have implemented frame grabbing and passing via VFW. As you all know, that is limited to AVI files so I wanted to extend functionality by enabling Directshow sources.
Coming down to the problem, just like AviSynth, my framework needs to be able to seek (random access) to a keyframe, grab it and deliver it to the metric for processing. Random access is required because a complex metric might request a previous or next frame so the processing cannot happen in a sequential way.
Before you ask why don't I use the files wrapped in an .avs script, that is not as efficient because the samples delivered will appear to be keyframes always while that's not the case in the original video.
I have been so far using this method to seek and grab:
- Build a graph
- Insert a Sample Grabber filter (the one provided with directx)
- Set the grabber to one shot mode
- Seek to the frame position requested (IMediaSeeking::SetPositions/AM_MEDIA_SEEKING_AbsolutePositioning is used for this)
- Play the graph and wait for it to finish through IMediaEvent::WaitForCompletion()
- Give away the result of the frame buffer
The problem here is that it makes the whole process very slow for some reason. To put down the numbers, in normal mode, the graph (with clock set to 0) will run at about 80 fps. Using this method, it runs at about 4-5fps.
I have came to the conclusion that this is because of the seeking (I also checked that the graph is paused, not stopped by the sample grabber). I tried to use Relative/Incremental Positioning as well without managing to get it to seek to the frame I wanted. I looked at the directshow docs again and again but no good.
So, the question is. Is there a better/faster method to seek/grab frames? Is RelativePositioning faster compared to AbsolutePositioning?
Also, I peaked at AviSynth's source for DirectShowSource class and I saw that it uses a custom SampleGrabber to get the frames off the video. Why is that? Or in other words, do you achieve faster seeking that way?
Any help would be appreciated.