1、Copyright 2016 by THE SOCIETY OF MOTION PICTURE AND TELEVISION ENGINEERS 3 Barker Avenue, White Plains, NY 10601 (914) 761-1100 Approved July 29, 2016 SMPTE EG 40:2016 Revision of SMPTE EG 40:2012 SMPTE ENGINEERING GUIDELINE Conversion of Time Values between SMPTE ST 12-1 Time Code, MPEG-2 PCR Time
2、Base and Absolute Time Page 1 of 20 pages Table of Contents Page Foreword . 2 Introduction 2 1 Scope . 3 2 Conformance Notation . 3 3 Informative References 3 4 Terms and Definitions 4 5 Arithmetic Operators 5 6 Basic Conversion Formulas . 5 6.1 Conversion of SMPTE ST 12-1 Time-Address Value to Loca
3、l Wall Clock Time . 5 6.2 Conversion of Local Wall Clock Time to MPEG-2 PCRtb Value . 7 6.3 Conversion of SMPTE ST 12-1 Time-Address Value to MPEG-2 PCRtb . 7 6.4 Conversion of MPEG-2 PCRtb Value to Local Wall Clock Time . 8 6.5 Conversion of Local Wall Clock Time to SMTPE ST 12-1 Time-Address Value
4、 . 8 6.6 Conversion of MPEG-2 PCRtb Value to SMPTE ST 12-1 Time-Address Value . 12 7 Conversion Formulas with Audio Sample Number Extension . 13 7.1 Conversion of SMPTE ST 12-1 Time-Address Value with Sample Number to Local Wall Clock Time 14 7.2 Conversion of SMPTE ST 12-1 Time-Address Value with S
5、ample Number to MPEG-2 PCRtb Value 14 7.3 Conversion of Local Wall Clock Time to SMTPE ST 12-1 Time-Address Value with Sample Number 14 7.4 Conversion of MPEG-2 PCRtb Value to SMPTE ST 12-1 Time-Address Value with Sample Number 15 Annex A Examples 17 A.1 SMPTE ST 12-1 Time Code to MPEG-2 PCR Time Ba
6、se Conversion . 17 A.2 MPEG-2 PCR Time Base to SMPTE ST 12-1 Time Code Conversion . 18 Annex B Placement of SMPTE ST 12-1 Time Code into MPEG-2 or MPEG-4 AVC Video . 20 B.1 Placement in MPEG-2 Video . 20 B.2 Placement in MPEG-4 Part 2 Video 20 B.3 Placement in MPEG-4 AVC Video 20 SMPTE EG 40:2016 Pa
7、ge 2 of 20 pages Foreword SMPTE (the Society of Motion Picture and Television Engineers) is an internationally-recognized standards developing organization. Headquartered and incorporated in the United States of America, SMPTE has members in over 80 countries on six continents. SMPTEs Engineering Do
8、cuments, including Standards, Recommended Practices, and Engineering Guidelines, are prepared by SMPTEs Technology Committees. Participation in these Committees is open to all with a bona fide interest in their work. SMPTE cooperates closely with other standards-developing organizations, including I
9、SO, IEC and ITU. SMPTE Engineering Documents are drafted in accordance with the rules given in its Standards Operations Manual. SMPTE EG 40 was prepared by Technology Committee 32NF. Introduction This section is entirely informative and does not form an integral part of this Engineering Document. Th
10、is Engineering Guideline provides a set of formulas for common time related conversions in the hope that implementers will do these calculations in a similar and interoperable manner. An earlier revision of this document used the term “absolute time” to refer to time that may be more clearly termed
11、“local wall clock time.” This is the time of day in the local time zone typically measured by “the clock on the wall” and not necessarily tightly tied to an International standardized time reference (UTC, GPS, etc.). Other SMPTE Engineering documents may provide for defined calculations to convert “
12、local wall clock time” to an International standardized time reference (UTC, GPS, etc.). SMPTE EG 40:2016 Page 3 of 20 pages 1 Scope This guideline specifies a set of formulas for converting between “SMPTE 12M time code” (correctly SMPTE ST 12-1 time code), MPEG-2 systems layer program clock referen
13、ce (PCR) time base, and local wall clock time. Included are formulas for converting SMPTE ST 12-1 time address values and MPEG-2 PCR time base values to local wall clock time, and formulas for converting SMPTE ST 12-1 time address values directly to/from MPEG-2 PCR time base values. Local wall clock
14、 time conversion formulas are useful for converting between different frame rates of SMPTE ST 12-1 time code; e.g., a 24-fps SMPTE time code running at 23.976 fps could be converted to true time and then to a 29.97 drop frame SMPTE time code value. Finally, a discussion of how ST 12-1 time code may
15、be carried within the coded video structures of both MPEG-2 and MPEG-4 AVC is provided. 2 Conformance Notation This Engineering Guideline is purely informative and meant to provide tutorial information to the industry. It does not impose Conformance Requirements and avoids the use of Conformance Not
16、ation. Engineering Guidelines frequently provide tutorial information about a Standard or Recommended Practice and when this is the case, the user should rely on the Standards and Recommended Practices referenced for interoperability information. 3 Informative References At the time of publication,
17、the editions indicated were valid. All standards are subject to revision, and parties to agreements based on this guideline are encouraged to investigate the possibility of applying the most recent edition of the standards indicated below. SMPTE ST 12-1:2014, Time and Control Code SMPTE ST 170:2004,
18、 Television Composite Analog Video Signal NTSC for Studio Applications SMPTE ST 272:2004, Television Formatting AES Audio and Auxiliary Data into Digital Video Ancillary Data Space SMPTE ST 339:2015, Format for Non-PCM Audio and Data in AES3 Generic Data Types SMPTE ST 340:2015, Format for Non-PCM A
19、udio and Data in AES3 ATSC A/52 Digital Audio Compression Standard for AC-3 and Enhanced AC-3 Data Types Compression Standard for AC-3 and Enhanced AC-3 Data Types AES11-2009 (r2014): AES Recommended Practice for Digital Audio Engineering Synchronization of Digital Audio Equipment in Studio Operatio
20、ns IEC 60461:2010, Time and Control Code ISO/IEC 14496-2:2004, Information Technology Coding of Audio-Visual Objects Part 2: Visual Recommendation ITU-R BT.1700 (02/2005), Characteristics of Composite Video Signals for Conventional Analogue Television Systems Recommendation ITU-T H.222.0 | ISO/IEC 1
21、3818-1 (2014), Information Technology Generic Coding of Moving Pictures and Associated Audio Information: Systems Recommendation ITU-T H.262 | ISO/IEC 13818-2 (2012), Information Technology Generic Coding of Moving Pictures and Associated Audio Information: Video Recommendation ITU-T H.264 | ISO/IEC
22、 14496-10 (2014), Advanced Video coding for Generic Audiovisual Services SMPTE EG 40:2016 Page 4 of 20 pages 4 Terms and Definitions For the purposes of this document, the following terms and definitions apply. 4.1 AVC An abbreviation for Advanced Video Coding, documented in ISO/IEC 14496-10. 4.2 GP
23、S An abbreviation for Global Positioning System. 4.3 local wall clock time This is the time of day in the local time zone typically measured by “the clock on the wall” and not necessarily tightly tied to an International standardized time reference (UTC, GPS, etc.). 4.4 MPEG-2 A suite of standards d
24、istributed as parts under the identifier ISO/IEC 13818. Part 1 is MPEG-2 Systems. Part 2 is MPEG-2 visual (video coding). 4.5 MPEG-4 A suite of standards distributed as parts under the identifier ISO/IEC 14496. Part 2 is MPEG-4 visual. Part 10 is AVC. 4.6 PCR An abbreviation for Program Clock Refere
25、nce. (Note: See ISO/IEC 13818-1.) 4.7 UTC An abbreviation for Coordinated Universal Time. 4.8 WWV The call sign of the United States National Institute of Standards and Technologys (NIST) HF (“shortwave“) radio station in Fort Collins, Colorado. SMPTE EG 40:2016 Page 5 of 20 pages 5 Arithmetic Opera
26、tors The arithmetic operators used in the conversion formulas are defined as follows: + Addition Subtraction x Multiplication / or Division = Assignment = Equal to (comparative) Less than % Modulus operator int (x) Largest integer not greater than x ceil (x) Smallest integer not less than x 6 Basic
27、Conversion Formulas The following formulas define the conversion between SMPTE ST 12-1 time code time-address values and the MPEG-2 PCR time base values, referred to as PCRtb. The resulting PCR time base value may or may not be equal to the program clock reference base (PCRB) counter used in the MPE
28、G-2 transport system; however, it will always be synchronous with the actual PCRB counter, differing by a constant. The formulas given here are limited to the resolution of the PCRB counter that is 1/300 of the MPEG-2 system clock frequency of 27 MHz (i.e., 90 kHz). Conversion to the full PCR counte
29、r resolution is not considered in these formulas. Time values are in units of seconds. This document does not account for the existence of frame rates greater than 30 Hz. Section 12 of SMPTE ST 12-1 provides the necessary constraints for utilization of SMPTE ST 12-1 time code time-address values wit
30、h 50-Hz and 60-Hz progressive scanning systems. The reader is cautioned that many applications of this guideline may require attention to video system frame rate before doing a calculation related to time code. Note: The results of dividing the integer frame rates by 1.001 do not result in precise d
31、ecimal numbers, for example, 30/1.001 is 29.970029970029. (to 12 decimals). This is commonly abbreviated as 29.97. In a similar manner, it is common to abbreviate 24/1.001 as 23.98, 48/1.001 as 47.95, and 60/1.001 as 59.94. These abbreviations are used throughout this document. Sufficient precision
32、is necessary in calculations to assure that rounding or truncation operations will not create errors in the end result. This is particularly important when calculating audio sample alignments or when long-term time keeping is required. 6.1 Conversion of SMPTE ST 12-1 Time-Address Value to Local Wall
33、 Clock Time These formulas presume an alignment between midnight (time zero) and time-address 00:00:00:00. For systems with an integer number of frames per day, this alignment may be achieved and maintained. For systems with a noninteger count of frames per day, such as with 29.97-Hz frame rates, th
34、ere will be a daily phase variation between midnight and time-address 00:00:00:00. SMPTE EG 40:2016 Page 6 of 20 pages 6.1.1 General = (_ ) where: _ = total number of elapsed frames since time address 00:00:00:00 6.1.2 23.98. frames/sec non-drop frame = ( 124 10011000) ( + 24 ( + 60 ( + 60 ) = ( 100
35、124,000) ( + 24 + 1440 + 86,400 ) 6.1.3 24 frames/sec = ( 124) ( + 24 ( + 60 ( + 60 ) = ( 124) ( + 24 + 1440 + 86,400 ) 6.1.4 25 frames/sec = ( 125) ( + 25 ( + 60 ( + 60 ) = ( 125) ( + 25 + 1500 + 90,000 ) 6.1.5 29.97. frames/sec drop frame = ( 130 10011000) ( + 30 ( + 60 ( + 60 ) 2 + 2 int(10 ) 108
36、 ) = ( 100130,000) ( + 30 + 1798 + 2 int(10 ) + 107,892 ) 6.1.6 29.97. frames/sec non-drop frame = ( 130 10011000) ( + 30 ( + 60 ( + 60 ) = ( 100130,000) ( + 30 + 1800 + 108,000 ) SMPTE EG 40:2016 Page 7 of 20 pages 6.1.7 30 frames/sec = ( 130) ( + 30 ( + 60 ( + 60 ) = ( 130) ( + 30 + 1800 + 108,000
37、 ) 6.2 Conversion of Local Wall Clock Time to MPEG-2 PCRtb Value = int( 90,000) % 233 (Since the PCRtb is based on a 33-bit digital counter and the local wall clock time value can exceed this limit, a correction has been included that constrains the PCRtb value to 33-bits.) 6.3 Conversion of SMPTE S
38、T 12-1 Time-Address Value to MPEG-2 PCRtb 6.3.1 General = (_ ) 90,000 where: _ = total number of elapsed frames since time address 00:00:00:00 Note: In the formulas below, 3750 = 90,000 / 24 and 3600 = 90,000 / 25. 6.3.2 23.98 frames/sec non-drop frame = ceil( 100124,000 90,000 ( + 24 ( + 60 ( + 60
39、) = ceil( 100124,000 90,000 ( + 24 + 1440 + 86,400 ) = ceil(1001 90,00024,000 + 90,090 + 5,405,400 + 324,324,000 ) 6.3.3 24 frames/sec = 3750 ( + 24 ( + 60 ( + 60 ) = 3750 ( + 24 + 1440 + 86,400 ) = 3750 + 90,000 + 5,400,000 + 324,000,000 6.3.4 25 frames/sec = 3600 ( + 25 ( + 60 ( + 60 ) = 3600 ( +
40、25 + 1500 + 90,000 ) = 3600 + 90,000 + 5,400,000 + 324,000,000 SMPTE EG 40:2016 Page 8 of 20 pages 6.3.5 29.97. frames/sec drop frame = 3003 ( + 30 ( + 60 ( + 60 ) 2 + 2 int(10 ) 108 ) = 3003 ( + 30 + 1798 + 2 int(10 ) + 107,892 ) = 3003 + 90,090 + 5,399,394 + 6006 int(10 ) + 323,999,676 hours 6.3.6
41、 29.97. frames/sec non-drop frame = 3003 ( + 30 ( + 60 ( + 60 ) = 3003 ( + 30 + 1800 + 108,000 ) = 3003 + 90,090 + 5,405,400 + 324,324,000 6.3.7 30 frames/sec = 3000 ( + 30 ( + 60 ( + 60 ) = 3000 ( + 30 + 1800 + 108,000 ) = 3000 + 90,000 + 5,400,000 + 324,000,000 6.4 Conversion of MPEG-2 PCRtb Value to Local Wall Clock Time = (90,000) 6.5 Conversion of Local Wall Clock Time to SMTPE ST 12-1 Time-Address Value 6.5.1 General _ = int(_ ) = int( _ 60 60) = % 24 = int(_ _ 60 60