[Ffmpeg-devel] Re: changes to asf demuxer

Jon Elwood jelwood
Mon Mar 19 18:37:45 CET 2007


I have been trying to track down the problem where ffmpeg sometimes detects
the fps in dvr-ms files as 0.83 fps (or 1/12).  Unfortunately, I've tracked
the problem to a place in the code where I don't understand what's
happening.  I know these questions are probably basic concepts for this
application, but I've just started looking at the ffmpeg source and I don't
understand half the things that it's doing.  Can anyone give me some
guidance and point me in the right direction?  

The problem seems to be with:

'ic->streams[i]->r_frame_rate.num' and 'ic->streams[i]->r_frame_rate.den'

 

I traced them into the 'av_find_stream_info()' function in utils.c.  In this
function 'av_reduce' is called - here is the actual line:

av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den,
get_std_framerate(j), 12*1001, INT_MAX);

 

I put a printf statement before and after this call and here is what I see.

Going into the function call:

 

st->r_frame_rate.num = 0

 

st->r_frame_rate.den = 0

 

get_std_framerate(j) = 0.0

 

Coming out of this function call:

 

st->r_frame_rate.num = 1

 

st->r_frame_rate.den = 12

 

get_std_framerate(j) = 0.0

 

So, r_frame_rate.num and r_frame_rate.den must be set somewhere in here.
The problem is I looked in av_reduce and I have no idea what this function
does.  What is the purpose of this function (I found it in fational.c, but I
didn't understand its purpose)?  What's interesting is I have at least 20
shows where ffmpeg detects the fps incorrectly and it always detects it as
1/12.  These show vary in duration and even vary in Mpeg-2 resolution and
sound encoding (some are MP2 and some are AC3).  However, if ffmpeg doesn't
detect the fps correctly it always reports it as 1/12.

 

Below is the information I get on a show ffmpeg converts correctly.

st->r_frame_rate.num = 0

 

st->r_frame_rate.den = 0

 

get_std_framerate(j) = 0.0

 

Coming out of this function call:

 

st->r_frame_rate.num = 179

 

st->r_frame_rate.den = 6

 

get_std_framerate(j) = 0.0

 

 

Also, in this section it seems like something weird is happening with
'duration_count[i]'.  It seems that it isn't being set correctly (at least
to me it didn't seem correct) on line 1805 'duration_count[index]++;'.  If I
add a printf statement just below 'duration_count[index]++;' here is what I
get.

duration_count[index] 1

duration_count[index] 1

duration_count[index] 1

duration_count[index] 2

duration_count[index] 2

duration_count[index] 3

 

This isn't what I expected.  Is this correct?

 

Below is the information I get on a show that ffmpeg converts correctly (it
confused me even more).

 

duration_count[index] 1

duration_count[index] 2

duration_count[index] 1

duration_count[index] 3

duration_count[index] 2

duration_count[index] 4

duration_count[index] 5

duration_count[index] 3

duration_count[index] 6

duration_count[index] 7

duration_count[index] 4

duration_count[index] 5

duration_count[index] 8

duration_count[index] 9

duration_count[index] 6

duration_count[index] 10

duration_count[index] 7

duration_count[index] 8

 

Again, sorry for the questions from a Newb, but I'm lost and didn't know
what else to do.





More information about the ffmpeg-devel mailing list