Log in

View Full Version : How to handle variable frame rate in getframe?


bababm
11th April 2010, 15:33
Dear Experts,
I am working on text detection in my filter. I keep a sliding window of previous and future frames to detect is there a text region of current frame.
It works on constant frame rate of input video, however I get an empty frame (black image) when the source input is variable frame rate.

Here is the situation I found.
n is current frame, getframe(n+1) works, but getframe(n+2), getframe(n+3) and .. getframe(n+x) returns me a black image.

Does getframe work in variable frame rate?

TheFluff
12th April 2010, 18:25
I don't think I've understood the question (what source filter are you using?), but for your information Avisynth is not VFR-aware. It will always assume the input has a constant framerate. That doesn't affect retrieving a frame by its number, though.

bababm
13th April 2010, 19:08
Here is the script I used
>clip=DirectShowSource("example.mp4",fps=15, convertfps=true)
>TextDetect(clip)
TextDetect is the filter I implement
if example.mp4 is constant frame rate, GetFrame(n+x) works,
but if example.mp4 is variable frame rate, GetFrame(n+x) doesn't

any suggestion?:thanks:

Guest
13th April 2010, 20:10
DirectShowSource is not always accurate for random frame access. Try DSS2().

bababm
15th April 2010, 10:14
Great !! It works.:thanks: