[Ffmpeg-devel] Problem in calculating FPS of video frame in 3gp file

Vikram Singh vikram.vishen
Thu Feb 23 08:11:44 CET 2006


Hi All,

I am stuck at one place in my project. I am writting a file streamer which
can parse 3gp file or MP4 file and do real time streaming. I am not able to
find out the video frame duration? From which table I should calculate that?


I have sample 3gp file and in that within "Decoding Time To Sample Box" -
stts the sample delta value is 6006 for all the video sample present.

I am able to interpret audio frame duration and the value of Sample delta
for audio track make sense as it is 160 samples, i.e 1F = 20ms
and according to 8000 smaples/sec, its 8sample/ms so 160 makes sense.

I am confuse about this video sample delta, actually I read one frame to
stream and then I start a timer for whose duration should be equal to the
Frame that I have read, so I know the sample size and sample delta, but not
able to calculate frame duration.

I used TimeToSample table and I am able to calculate FPS when the video data
is encoded in H263, the Sample_Delta was 6006 and I used video sampling rate
as 90,000 and this is how I calculated the FPS:

iFrameDuration = 6006/90;
iFPS = (1000/iFrameDuration);

But if I use the same logic to calculate FPS for another sample 3gp file
which has MP4 encoded video frame and whose TimeToSample table has 2400,
then the FPS is coming to 37 FPS, according to how I calculated FPS for H263
above.

But when I  opened the file using Quick time and I saw the movie info it
shows 12 FPS, I am really confused as what is the proper way to calculate
FPS.

Thanks,
Vikram


Can you please help me with this?




More information about the ffmpeg-devel mailing list