Talk:MPEG transport stream

Latest comment: 2 years ago by Moonsurfer1 in topic Payload: Small correction/Clarification required

Payload: Small correction/Clarification required

edit

When the payload is a PSI Table (such as PAT/PMT), the payload pointer field will be available if the PUSI bit is set. However, if the payload is a PES packet, the payload pointer field is NOT available if the PUSI bit is set.

Source: ITU-T Rec. H.222.0 (02/00) "Information technology – Generic coding of moving pictures and associated audio information: systems", page 39 (semantic pagenr 19), section 2.4.3.3 (https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.222.0-200002-S!!PDF-E&type=items) — Preceding unsigned comment added by Moonsurfer1 (talkcontribs) 09:25, 9 June 2022 (UTC)Reply

Better Start

edit

It seems to me that computer and IS people have a difficult time properly describing things like this. I can't tell from the article what a transport stream is in a physical sense. Is it just a data format that does not have any particular physical characteristics? Is it a disk file? Is it data that is moving from one place to another via some kind of cable? Or via RF transmission? Is it something else? Or some combination of the above? Where exactly does it fit in the physical world? If it can exist in two or more physical forms, which are more common? I have read this article and many other items on MPEG but am still confused on this point. Shouldn't an article like this, which is intended for the world at large and not just computer specalists, start out with a basic explanation? EPA3 (talk) 18:49, 16 September 2009 (UTC)Reply

It starts by saying that it is a protocol, and goes on saying that it is a digital container that encapsulate various things. Why is it unclear? Are you saying that we should avoid the words protocol and digital container in the first lines and substitute them with more common words? --Pot (talk) 06:50, 17 September 2009 (UTC)Reply

if every article start with a basic explanation in which amatures and nonspecialists can understand easily, then for each subject we should have a lot of unnecessary and repetitive text and articles. it is up to the reader to read prerequisites for the subject. and these prerequisites must be linked to, everywhere which is referenced to in the article. —Preceding unsigned comment added by 91.184.72.22 (talk) 12:08, 7 June 2010 (UTC)Reply

That's fine, but there's nothing wrong with a decent introduction. It's writing fundamentals. 173.11.177.129 (talk) 03:24, 8 June 2010 (UTC)Reply
That's right, but "Decent" does not mean "complicated". Scaring off readers with redundant words such as "multiplexed" and "synchronized" is unwarrented. Fleet Command (talk) 19:31, 8 June 2010 (UTC)Reply
I am not sure that "communications protocol" is an accurate description of an MPEG TS. In fact, it is a multiplexing format that is used for transmission and storage in unreliable environments. --Pot (talk) 15:37, 9 June 2010 (UTC)Reply
Alright then, what do you say to "standard"? Is MPEG TS a standard? How about we change "communication protocol" to "standard"? Fleet Command (talk) 20:34, 9 June 2010 (UTC)Reply
Standard alone is too vague. A "standard format" would be more accurate, but standard is not very informative either. What about A format for transmission and storage ... ? Or A digital format. Or An encapsulation format (maybe more accurate, but also less widely comprehensible. --Pot (talk) 15:45, 10 June 2010 (UTC)Reply
I agree with "standard format". Fleet Command (talk) 23:46, 10 June 2010 (UTC)Reply

Programs that open TS files

edit

Deleted the section because it is a spam magnet. Perhaps it can be brought back as "notable Programs that open TS files", and require any program to have at least 3 references and or wikipedia article? Daniel.Cardenas (talk) 17:58, 13 December 2010 (UTC) it looks like the section is back with comically few programs listed. It needs to be deleted, expanded, or have the selection criteria detailed.70.75.81.177 (talk) 18:09, 4 March 2012 (UTC)Reply

seems fien to me it has some references and it linked to the programs on wikipedia articles--Andrewcrawford (talk - contrib) 18:28, 4 March 2012 (UTC)Reply
I have split this out to List of programs that open TS files. Doing so has improved the article in my judgement. --Kvng (talk) 17:23, 20 May 2012 (UTC)Reply


How is the data stored in a file (.ts)?

edit

Byte 1 is always 0x47.

However the next section comprises 2 bytes

Partial Transport Stream Packet Format
Name Number
of bits
Description
Transport Error Indicator (TEI) 1 Set by demodulator if can't correct errors in the stream, to tell the demultiplexer that the packet has an uncorrectable error [1]
Payload Unit Start Indicator 1 1 means start of PES data or PSI otherwise zero only.
Transport Priority 1 1 means higher priority than other packets with the same PID.
PID 13 Pack

This is where the EXACT manner that the data is stored becomes important. While the data is a 16bit integer, remember those 16bits are divided evenly into 2 bytes. And just HOW they are divided into those 2 bytes will depend on how the program I'm about to write will have to go about reading the PID.

The 2 things to look at is BYTE ORDER, and BIT ORDER. The byte order will either be big endian (most significant byte first)or little endian (least significant byte first). And within each byte it can either be MSB first (bit7 first), or LSB first (bit0 first). And so there is a question of exactly which combination is used in an Mpeg2 Transport Stream. And the EXACT combination of these will become very tricky when trying to read data that is not a nice multiple of 8bits, in this case the PID which is 13 bits long, so while it crosses byte boundaries, it does NOT completely fill both bytes.

Therefore BOTH the BIT ORDER as well as BYTE ORDER will be EXTREMELY IMPORTANT for me to know, if I am to successfully write this program that I'm trying to write, who's purpose will be to extract the PID out of every packet of an MPEG2 Transport Stream file.

Please help. Thanks in advance.

76.104.145.19 (talk) 10:50, 17 August 2012 (UTC)Reply


Nevermind the above question, I finally figured it out. I even created a sample program in VB6 that works. It reads and then outputs to a textfile the packet header data from a 188 byte MPEG2 Transport Stream (.ts) file. It's a very simple program, and doesn't really do a lot, but at least it works so far.

Private Type TsPacket
SyncByte As Byte
Flags1(1) As Byte
Flags2 As Byte
TsData(183) As Byte
End Type

Dim Flags1() As Byte
Dim TEI As Boolean
Dim PUSI As Boolean
Dim TP As Boolean
Dim PID As Integer

Dim Flags2 As Byte
Dim Scrambling As Byte
Dim AdaptationFieldIndicator As Byte
Dim ContinuityCounter As Byte


Private Sub Form_Load()
Dim TS() As TsPacket

Open "C:\testvideo.ts" For Binary Access Read As #1
ReDim TS(LOF(1) \ 188 - 1)
Get #1, 1, TS()
Close #1

Open "C:\test.txt" For Output As #2

For n = 0 To UBound(TS)
If TS(n).SyncByte = &H47 Then
Flags1() = TS(n).Flags1()
Flags2 = TS(n).Flags2

TEI = Flags1(0) And (2 ^ 7)
PUSI = Flags1(0) And (2 ^ 6)
TP = Flags1(0) And (2 ^ 5)

PID = 0
For i = 0 To 4
PID = PID + ((Flags1(0) And (2 ^ (4 - i))) \ (2 ^ (4 - i))) * (2 ^ (12 - i))
Next i

For i = 0 To 7
PID = PID + ((Flags1(1) And (2 ^ (7 - i))) \ (2 ^ (7 - i))) * (2 ^ (12 - (i + 5)))
Next i

Scrambling = (Flags2 And 64) \ 64
Scrambling = Scrambling + ((Flags2 And 128) \ 64) * 2

AdaptationFieldIndicator = (Flags2 And 16) \ 16
AdaptationFieldIndicator = AdaptationFieldIndicator + ((Flags2 And 32) \ 32) * 2

ContinuityCounter = Flags2 And 15

Print #2, TEI, PUSI, TP, GetHex(PID), Scrambling, AdaptationFieldIndicator, ContinuityCounter
End If
Next n
Close #2

End Sub


Private Function GetHex(ByVal Value As Integer) As String
GetHex = String$(4 - Len(Hex(Value)), "0") & Hex(Value)
End Function


76.104.145.19 (talk) 12:10, 17 August 2012 (UTC)Reply


I don't think the mask given for PID is correct: 0x1fff00. I believe it should be 0x1fff, being the least significant 13 bits (big endian) Manolan1 (talk) 15:54, 22 April 2020 (UTC)Reply

 Ah, scratch that, I see what you have done! Manolan1 (talk) 15:56, 22 April 2020 (UTC)Reply

References

  1. ^ "TSReader". Coolstf.com. 2008-04-07. Retrieved 2012-05-17.

PowerPoint Presentation (MPEG2.PPT)Can't Be Opened by Power Point

edit

Can the file/link be updated or corrected? Jeris0102 (talk) 20:33, 4 June 2014 (UTC)Reply

edit

Hello fellow Wikipedians,

I have just modified 3 external links on MPEG transport stream. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

 Y An editor has reviewed this edit and fixed any errors that were found.

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 00:08, 29 May 2017 (UTC)Reply