Time code
First, concept
Here we must explain an important concept in the media stream processing - time coding.
Time encoding is an auxiliary data for video and audio streams. It is included in the video and audio files, we can understand the timestamp.
SMPTE Timecode is a sum of SMPTE time and control code, which is a video and continuous digital address, logo, and additional data in audio streams. It is defined in ANSI / SMPTE12-1986. Its purpose is to provide a video and audio address that can be processed by computer.
The data structure of the most SMPTE time code is an 80bit, which contains the following:
A, one hH :: mm :: ss :: ff (hour :: minute :: second ::) format timestamp.
B, 8 4-bit binary data is often called "user bit".
C, different signs
d, synchronous sequence
e, the test and
This format is defined in DirectShow as Timecode_Sample.
The time code is divided into two forms, one is a linear time format LTC (longitudinal encoding), and each time code is representative in the continuous time. Another time code is VITC (lateral coding) that stores two lines of the video signal in the vertical elobes, and some are between 10 and 20.
The LTC time code is added to, for example, it will be very easy because it is an isolated audio signal encoding. But it cannot be read when the tape drive is suspended, slow, and fast forward. In addition, it may lose all the way an audio signal in a non-professional recorder.
Vitc time code is different from LTC, which can be read at 0-15 times. It can also be read from a video capture card. But if it wants to be recorded to the tape, some other devices may be needed, usually those devices are more expensive.
The SMPTE time code supports two modes, one is a non-throwing mode, one is a throwing mode. In the non-drop mode mode, the time code is recorded in a continuous growth. It can complete the real playback work to reach 30, or higher.
NTSC's video playback standard is 29.97 / per second, which is considering compatibility of monochrome television systems. This leads to a question. In the non-turbulence mode, there will be a 108-hour step in an hour, that is, when the real time is only one hour, the time code is only read 00: 59: 56: 12, when you calculate There are some problems when the streaming of the stream is played. In order to solve this problem, we can jump in the case of tolerance. This approach is not jumped by skipping two but 00, 20, 30, 40, 50 minutes while starting counting at each minute. Using such a program Our network test results are less than one hour, and every 24 hours of error is about 3.
In the current actual work, although both modes are available at the same time, the loss of the share mode is usually adopted.
Second, the typical application of time code
Control peripherals to perform video capture and editing is a typical application. This application needs to identify each of the video and audio, however, the method used to use the SMPTE time code. Linear editing systems typically control three or more tape machines, but also switch between the optical disk bulletin as much as possible. The computer must execute the command, so you must get the address of the specified location of the video tape at a specific time. There are many ways to use timecases in the application, mainly below these species:
a, track video and audio sources throughout the editing process
B, synchronous video and audio.
C, synchronous multiple devices
D, use undefined bytes in the time code, called: userbits. This usually contains the date, ASCII code or the industrial information of the movie.
Third, capture time code
Typically, the time code is generated by some capture card devices that produce a time code capability. For example, an RS-422 requires a timecode to control peripherals and host communication. After the time is generated, we need to obtain a time code from the flow format video and audio, which can be accessed later. Then we handle the time code by the following steps:
A. Create a discontinuous index of each 桢 position, corresponding to each of them. This list is written at the end of the file after the capture is completed. The list can be a matrix array of this structure below. For the sake of brevity, it is only a simplified DirectShowTimeCode_Sample structure.
Struct {
DWORD dwoffset; // Dejection in
Char [11] sztc; // The value of the time code in the offset value
//HH: mm: ss: ff is a non-dropped format hh: mm: ss; ff is a format
} TIMECODE;
For example, here you can give a time code in a video capture stream:
{0, 02: 00: 00: 02},
{16305, 15: 21: 13: 29} // Time format in 16305
Use this table, any time code will be calculated.
B. Another approach is to write time code as video and audio data. This kind of we don't recommend it, therefore it is not introduced.
The file written to the time code can be edited, composite, synchronized, etc. Here is here, it is enough for us to understand the time size. Many of the other is about the standard introduction, everyone is interested in seeing.