Read magic number

Peter Volz 1,295 Reputation points
2024-03-10T19:14:44.72+00:00

Hello,

I have problem understanding one particular file type here:

https://en.wikipedia.org/wiki/List_of_file_signatures

ts MPEG Transport Stream (MPEG-2 Part 1)

Magic number hex signature is only 1 byte: &H47 / G

But there are notes I cannot figure out:

0

0xBC

0x178

...

(every 188th byte)

I use:

ReadByte.Take(1).SequenceEqual({&H47})

Anyone knows how to cover this type?

Thanks in advance :)

Developer technologies | VB
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2024-03-11T01:34:28.5033333+00:00

    Hi @Peter Volz ,

    In the context of MPEG Transport Stream (MPEG-TS) files, where the packet size is typically 188 bytes, the offset refers to the starting positions of individual MPEG-TS packets within the file.

    So 47 appears at every 188th byte, judging only the 47 at the beginning of a file can lead to confusion with other file types.

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.