[vdr] Frames per second PAL vs. NTSC

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Mon Jan 5 12:44:39 CET 2009


On 05.01.2009 11:57, Theunis Potgieter wrote:
> On 05/01/2009, Theunis Potgieter <theunis.potgieter at gmail.com> wrote:
>> On 05/01/2009, Klaus Schmidinger <Klaus.Schmidinger at cadsoft.de> wrote:
>>  > In order to correctly handle the progress indicator for NTSC
>>  >  recordings I'm now determining the frame rate from the
>>  >  actual data. With PAL's 25 frames per second the distance
>>  >  between two frames is 3600 "ticks" of 1/90000s. With NTSC
>>  >  this number is 3003, which results in 29.97002997003 fps.
>>  >  Is NTSC's frame rate really that "odd"? I thought it would
>>  >  be an even 30 fps.
>>  >
>>  >  Klaus
>>
>>
>> Yes
>>
>>  http://en.wikipedia.org/wiki/Frame_rate
>>  http://en.wikipedia.org/wiki/NTSC
>>
> 
> http://en.wikipedia.org/wiki/Sampling_frequency
> 
> Please do not always _assume_ that it is actually PAL or NTSC, since
> PAL or NTSC defines colour encoding, but the most of the time the
> usual frame rates are associated with the colour encoding. However
> like I've stated before nvidia on their newer drivers output PAL on
> 60Hz (on the tv-out of the card), not even 59.94006Hz, or 50Hz like
> PAL is supposed to be for interlaced. The older CRT TVs (interlaced
> monitors) expect PAL to run 50Hz. You can confirm this with xvidtune.

Detecting the frame rate is done by looking at the PTS values, so
it is independent of the actual broadcast system.

Using this code for converting frame numbers into hh:mm:ss.ff...

--------------------------------------------------------
#include <math.h>
#include <stdio.h>

int main(void)
{
  double FramesPerSecond = double(90000) / 3003;
  //FramesPerSecond = 25;
  for (int Index = 0; Index < 10000; Index++) {
      double Seconds;
      int f = round(modf(Index / FramesPerSecond, &Seconds) * FramesPerSecond) + 1;
      int s = int(Seconds);
      int m = s / 60 % 60;
      int h = s / 3600;
      s %= 60;
      printf("%3d ", Index);
      printf("%15.9f ", Index / FramesPerSecond);
      printf("%d:%02d:%02d.%02d", h, m, s, f);
      if (f > 30) printf(" *");
      printf("\n");
      }
}
--------------------------------------------------------

... sometimes results in a 31st frame:

9978   332.932600000 0:05:32.29
9979   332.965966667 0:05:32.30
9980   332.999333333 0:05:32.31 *
9981   333.032700000 0:05:33.02
9982   333.066066667 0:05:33.03


Any ideas how to fix this?

Klaus



More information about the vdr mailing list