Apple added support for fragmented mp4 files in HLS a few years ago, but not all devices have caught up to this change. So the majority of streams still use the older transport stream often called TS format. TS seems like an obscure format, but for people in the broadcast or cable tv world, the format is ubiquitous.
TS has some strange properties. It was built for a pre-ethernet world and includes features such as lost and out of order packet detection and remote time synchronization.
These features are required for digital over-the-air broadcasts, but on the internet this is usually handled via TCP and high precision clocks in every device. TS also uses a fixed packet size of bytes with each packet starting with a sync byte to identify the start of a packet.
Again, great when joining a multicast stream at a random location, like when changing the TV channel, but not necessary when video is saved as a file and pulled over HTTP, as is the case for HLS. The downside of not using these features is that they still take up space in the file.
For files with high bitrates this is not an issue, but in low bandwidth environments the overhead can be significant. This is unfortunate as a constrained bandwidth environment is precisely where bits are most in-demand. Each byte TS packet has a 4 byte header.
This header contains the sync byte, some flag bits, a packet id or PID, which identifies a unique audio or video stream , and a continuity counter used to identify missing or out of order packets. The PES header is a minimum of 14 bytes, or 19 bytes if the frame decode time does not match the presentation time, i.
B frames and encodes the frame timestamps among other things. See this ffprobe test from src code from gitHub. Is the same. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 6 years, 1 month ago. Active 6 years ago. Viewed 3k times. Improve this question. CompNet CompNet 77 1 1 silver badge 6 6 bronze badges. Additional optional transport fields, whose presence may be signalled in the optional adaptation field, may follow.
The rest of the packet consists of payload. Packets are most often bytes in length, but some transport streams consist of byte packets which end in 16 bytes of Reed-Solomon error correction data.
The byte packet size was originally chosen for compatibility with ATM systems [1]. Each table or elementary stream in a transport stream is identified by a bit PID. A demultiplexer extracts elementary streams from the transport stream in part by looking for packets identified by the same PID. Storage unit 2 C includes packet header , a second portion of packet 1 B, packet header , and packet 2 Storage Unit 3 D includes packet header , packet 3 , packet header , and packet 4 Each storage block or storage unit SU is fixed size e.
A storage packet for delivery may also span multiple storage units e. For a storage packet that spans multiple storage units, the successive portions each include a packet header to identify the information. For example, packet 0 B includes packet header to identify the contents of packet 0 B within storage unit 1 B. Specifically, with reference to the internal packet header of FIG.
Other storage packets for delivery may be contained entirely within one storage unit e. Reconstructed network packet includes network encapsulations Network encapsulations include an The delivery module determines that two null packets need to be inserted into the delivery sequence of reconstructed network packet which is associated with a delivery transport stream based on the data indicative of the reconstruction parameter of packet header i.
The data indicative of the reconstruction parameter includes the one or more null packet insertion locations based on the packet order of network packet For example, the delivery module reads the packet header and determines two Null packets e. The delivery module reconstructs the delivery sequence of TS packets by inserting the one or more null packets into the sequence.
The delivery module transmits the delivery sequence e. The delivery module reads the storage units e. Advantageously, the exact number and position of the TS Null packets at delivery by the delivery module is preserved as received by the ingest module in the video stream e.
By creating and storing network packet data in internal packets defined by the internal packet header at ingest e. Data that is to be put into network packets and sent by the delivery module may contain one or more internal packet format headers.
The internal packet format allows for placing packet headers at the beginning of each storage unit see e. This allows for control information and commands to be placed in-line with the data, as well as padding to align the packet data for simpler Delivery.
The internal packet header includes a reserved field , a TS Pkts field , a packet length field , and a timestamp The TS Pkts field indicates the number of Null packets that should be inserted at the location of the internal packet header within the storage packet. For example, the internal packet format includes a NULL type, and when the type field is set to NULL, the TS Pkts field is checked by the delivery module to determine the number of Null packets to insert into the reconstructed network packet.
The TS Pkts field is a 3-bit field, with a value range of zero to seven. The packet length field indicates the distance to the next internal packet header within the storage packet. Packet header can be an internal packet header For example, the type field is set to indicate that packet header is the internal packet header and does not include information regarding null packets e. With respect to step , the data indicative of the reconstruction parameter comprises a number of removed null packets at the insertion location.
In general, TS Null packets are removed and replaced with a more compact marker, the internal packet header , which is only 8-bytes long. If each TS packet is bytes, the storage packet replaces bytes with one 8-byte internal packet header The internal packet header indicates the position and the number of MPEG-2 TS packets being replaced at the insertion location.
As few as zero and as many as seven TS Null packets can be replaced with the internal packet header The internal packet header can exist in the middle of a data packet e. While diagram only shows two consecutive Null packets A and B, the internal packet header can be inserted into the video stream whenever one or more MPEG-2 TS Null packets are present. For example, if the TS 0 packet at location zero was a TS Null packet, TS 0 would be replaced with an internal packet header at location zero of storage packet , and the TS Pkts field would be set to indicate only one TS Null packet is to be inserted at location zero during reconstruction of the storage packet The internal packet header also indicates the packet length in the packet length field , indicating the remaining portion of the network packet stored in the storage packet If the length of the packet length field is zero, then no more data exists and the internal packet header is the last TS packet in the storage packet.
If the length of the packet length field is non-zero, the packet length field indicates the distance to the next internal packet header This can require, for example, keeping the TS Pkt field state from any previous internal packet headers inserted in place of TS null packets in order to know how many TS packets are in the network packet. Storage Block 0 A includes packet header e.
Storage Block 1 B includes packet header for the second portion of packet 0 B. Storage Block 1 B also includes packet header for the first portion of packet 1 A. Storage block 2 C includes packet header for the second portion of packet 1 B, and packet header for packet 2 , which includes Null packet and Null packet Storage block 3 D includes packet header for packet 3 , which includes Null packet at the end of packet 3 Storage block 3 D also includes packet header for packet 4 , which includes Null packet at the beginning of packet 4 For example, packet header is read from storage block 0 A, and the delivery module parses the header information to determine to read the first portion of packet 0 , A.
The delivery module reads Null packet e. For example, with reference to the storage packet , the delivery module reads Null packet from location three. With further respect to step , for each Null packet header read, the packet header includes data indicative of a reconstruction parameter that comprises a number of removed null packets at the location the storage packet is read from.
For example, with reference to Null packet of storage packet , the Null packet includes the TS Pkts field which indicates that there were two null packets e. With further respect to step , reconstructing comprises inserting the number of removed null packets e. For example, the delivery module inserts Null A and Null B at locations three and four to reconstruct the sequence of reconstructed network packet Advantageously, since on delivery the in-line null packets e.
The packet header includes data indicative of a reconstruction parameter, which includes a number of the one or more null packets removed from the first sequence e. For example, null packet is inserted at the end of internal packet at location five.
Advantageously, this embodiment avoids the complexity of inserting 8-bit Null packets in the middle of storage packets see e. This can reduce the delivery complexity and requires no additional storage since no byte shifting is needed in the middle of a packet. Storage Block 1 B includes packet header for the second portion of packet 0 B, which includes Null packet e.
Storage block 2 C includes packet header for the second portion of packet 1 B, and packet header for packet 2 , which includes Null packet Storage block 3 D also includes packet header for packet 4 For example, the delivery module reads Null packet of storage packet from the data storage device With further respect to step , the data indicative of the reconstruction parameter comprises a number of null packets removed from the first sequence.
For example, the delivery module reads the TS Pkts field from the Null packet to determine that two Null packets e. For example, with reference to FIG. The delivery module reads packet header , determines the header encapsulates data representative of the second portion of packet 0 B, and reads out the second portion of packet 0 B. While reading out the second portion of packet 0 B, the delivery module reads Null packet and determines based on the data contained within the header how many Null packets to insert in the reconstructed network packet With further respect to step , reconstructing comprises inserting the number of null packets indicated in the Null packet at the end of the storage packet into the reconstructed delivery sequence at the end of the delivery sequence.
For example, the delivery module inserts Null packets A and B at the end of the reconstructed network packet The exact number of received TS Null packets is preserved, except re-ordered and put at the end of the reconstructed network packet during output. For example, network packet included seven TS packets, two of which were Null packets A and B at locations three and four, respectively. Reconstructed network packet also includes seven TS packets, but the Null packets A an B are located at the last two positions five and six, respectively.
This can reduce delivery complexity. Appending Null packets can be a much simpler task and thus computationally less expensive than inserting TS packets into the middle of a network packet. This process of re-packing the received transport stream may require the PCR value to change if its position in the stream changes. Since this process can be performed when the stream is received, the stream can be delivered at scale with minimal complexity. In some embodiments, adjusting the PCR value can be avoided e.
This additional storage can be acceptable because it may not be often when Null packets precede the PCR value. Packet header can be an instance of internal packet header of FIG. For example, the TS Pkts field is set to indicate the total number of TS packets within the network packet. As explained with reference to FIG. In some examples, to avoid having separate internal null packet formats e. With further respect to step , the data indicative of the reconstruction parameter comprises the total number of packets and the packet length, from which the number of the one or more null packets removed from the first sequence can be derived e.
For example, if each TS packet is assumed to be bytes, the network packet e. The number of Nulls can be deduced from the difference between the packet length in the packet length field , divided by , and the number of TS Pkts indicated in the TS Pkts field In some embodiments, the internal packet format e. The packet length field can indicate the exact length of the internal packet.
For example, a field e. During reconstruction e. As such, the use of the TS Pkts field can indicate the total number of TS packets in the original network packet or the total number of TS Null packets removed from the original network packet.
Storage block 2 C includes packet header for the second portion of packet 1 B, and packet header for packet 2
0コメント