[Ffmpeg-devel] [PATCH] remove drop timecode flag

Trent Piepho xyzzy
Tue Apr 24 23:45:44 CEST 2007


On Tue, 17 Apr 2007, Michael Niedermayer wrote:
> On Mon, Apr 16, 2007 at 03:19:16PM -0700, Trent Piepho wrote:
> > long sec30k = i * 1001L;  // units of 1/30000th of a second
> > int secs = (sec30k/30000) % 60;
> > int mins = (sec30k/(30000*60)) % 60;
> > int hours= (sec30k/(30000*60*60)) % 24;
> > int frame= (sec30k%30000) / 1001;
> >
> > This problem with this is it doesn't follow the SMPTE/EBU/MPEG-2 spec:
> > Frame 1018, time 00:00:33.967, LTC 00:00:33:28 or 00:00:33;28, alt 00:00:33;28
> > Frame 1019, time 00:00:34.001, LTC 00:00:33:29 or 00:00:33;29, alt 00:00:34;00
> >
> > After '00:00:33;28' comes '00:00:33;29', according to the spec.  But this
> > way of creating timecodes has '00:00:34;00' instead.

The code to generate SMPTE/EMU spec drop-frame timecode:

int frames  = i % 17982;
int hours   = (i/(17982*6)) % 24;
int tenmins = (i/17982) % 6;
int onemins = (frames-2) / (60*30-2);
frames -= onemins * (60*30-2);  // not the same as frames %= (60*30-2)
int secs    = frames / 30;
frames %= 30;

Looks a lot more complex, but if you were creating a counter circuit using
discrete logic chips like a 74176 decade counter and 7448 BCD to 7-segment
converter, it would make more sense why they did it this way 30 years ago.




More information about the ffmpeg-devel mailing list