Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th September 2015, 11:33   #1  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
ShowSMPTE() drop-frame algorithms

I'm looking for the algorithms used to implement ShowSMPTE's drop-frame counting. It's help file covers NTSC TV, but none of the others:
Quote:
Something similar holds also for the following framerates:
framerate range base-rate
[47.951, 47.953] 48
[59.939, 59.941] 60
[119.879, 119.881] 120
I've found some discussion of NTSC film rate and double NTSC film rate, but nothing that indicates what was eventually decided upon.

Any ideas how those were implemented?
fvisagie is offline   Reply With Quote
Old 24th September 2015, 14:43   #2  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Sure, it's in the source code:
http://avisynth2.cvs.sourceforge.net...ew=markup#l815
Code:
	if (dropframe) {
	  if (rate == 30) {
		int c = 0;
		c = off_min + 60*off_hour;  // number of drop events
		c -= c/10; // less non-drop events on 10 minutes
		c *=2; // drop 2 frames per drop event
		offset_f -= c;
	  }
	  else {
//  Need to cogitate with the guys about this
//  gotta drop 86.3 counts per hour. So until
//  a proper formula is found, just wing it!
		offset_f -= 2 * ((offset_f+1001)/2002);
	  }
raffriff42 is offline   Reply With Quote
Old 24th September 2015, 15:31   #3  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
I have used this (in my own bash scripting)
From frames to DF timecode:

fps=30

D=$(( frames/17982 ))
M=$(( frames%17982 ))
frames=$(( frames+ 18*D + 2*((M - 2)/1798) ))

# Count frames, seconds, minutes and hours

frame=$(( frames%fps ))
second=$(( frames/fps%60 ))
minute=$(( frames/fps/60%60 ))
hour=$(( frames/fps/60/60%24 ))

It's based on the code provided by some SMPTE guy and works fine even up to 24H TC.
kolak is offline   Reply With Quote
Old 25th September 2015, 12:53   #4  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
I was afraid of having to look at code.

Thanks, I'm sure I'll be able to put this to good use.
fvisagie is offline   Reply With Quote
Old 25th September 2015, 12:56   #5  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
It works well, even if it looks strange
I did figure it out, but don't remember anymore.

Also note that DF timecode only exists for 29.97p, 59.94i, 59.94p.
There is no such a thing in the industry for eg. 23.976p.
kolak is offline   Reply With Quote
Old 28th September 2015, 08:49   #6  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
I managed, thank you both.
fvisagie is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:29.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.