MediaArea / MediaInfo

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://MediaArea.net/MediaInfo
BSD 2-Clause "Simplified" License
1.38k stars 160 forks source link

ESPN HD transport stream not finding streams #590

Open PaulF8080 opened 2 years ago

PaulF8080 commented 2 years ago

I recorded this transport stream with a silicondust hdhomerun. VLC plays it and shows the streams. espn.zip

PaulF8080 commented 2 years ago

I didn't know there was a CLI version until now.

MediaInfo.exe --Details=1 espn.ts 0006BF4 ---------------------------- 0006BF4 --- MpegTs, accepted --- 0006BF4 ---------------------------- 000792C 0x03E8 - TS_program_map_section (188 bytes) 000792C Header (4 bytes) 000792C sync_byte: 71 (0x47) 000792D transport_error_indicator: No 000792D payload_unit_start_indicator: Yes 000792D transport_priority: No 000792D pid: 1000 (0x03E8) - (13 bits) 000792F transport_scrambling_control: 0 (0x0) - (2 bits) 000792F adaptation_field_control (adaptation): No 000792F adaptation_field_control (payload): Yes 000792F continuity_counter: 13 (0xD) - (4 bits) 0007930 File Header (4 bytes) 0007930 pointer_field: 3 (0x03) 0007931 payload: (3 bytes)

od -Ax -t x1 espn.ts | grep ^00793 007930 03 ff ff ff 02 b0 b5 00 01 cf 00 00 e3 e9 f0 0c The pointer field is 3 so you should skip the 3 FF bytes.

MediaInfo_CLI_GNU_FromSource/MediaInfoLib/Source/MediaInfo/File_Mpeg_Psi.cpp

755 // 756 // Buffer - File header 757 // 758
759 //--------------------------------------------------------------------------- 760 void File_Mpeg_Psi::FileHeader_Parse() 761 { 762 //Parsing 763 if (From_TS) 764 { 765 int8u pointer_field; 766 Get_B1 (pointer_field, "pointer_field"); 767 if (pointer_field) 768 Skip_XX(pointer_field, "payload"); 769 } 770 }

The pointer field is one byte. Skip_XX takes an 8 byte argument void Skip_XX(int64u Bytes, const char* Name);

Maybe Skip_XX should be Skip_Hexa. void Skip_Hexa(int8u Bytes, const char* Name);

JeromeMartinez commented 2 years ago

Maybe Skip_XX should be Skip_Hexa. void Skip_Hexa(int8u Bytes, const char* Name);

"Hexa" is a representation for humans, it has no meaning there, an integer being an integer. Skip_XX() accepts a 8-bit integer there, it is just "upgraded" to 64-bit. They are not the issue.

I quickly checked the stream, issue is that the PSI is across 2 packets and the code which concatenates the 2 packets content is buggy (the payload_unit_start_indicator of the 2nd packet, legitimately set to 1 because there is another content after the first PSI, is considered as starting a completely new PSI and this is wrong, and pointer_field in the 2nd packet is not handled correctly as it is not read if the content is the continuity of the first packet and it should).

The fix there is not trivial so it is for when we have more free time.

PaulF8080 commented 2 years ago

Skip_Hexa is for parsing the the PMT table. The PMT is how the streams are found. If the PMT is parsed wrong, it explains why the streams are not found.

The human part for the CLI dump is also wrong. It does no skipping over the three bytes at all.

MediaInfoLib/Source/MediaInfo/Multiple/File_MpegTs.cpp:2384: Get_SB ( adaptation, "adaptation_field_control (adaptation)"); MediaInfoLib/Source/MediaInfo/Multiple/File_MpegTs.cpp:2385: Get_SB ( payload, "adaptation_field_control (payload)");

PaulF8080 commented 2 years ago

Well I've decided I have no clue. So never mind.

I got it to compile on my Ubuntu machine. I will play with the code in my free time. I'm curious, now.

PaulF8080 commented 2 years ago

Just for a learning experience I'm decided to learn gdb.. I got to the part where the PSI PMT is looking for the second packet. You found it much faster that than me :-) I learned a lot. Do you know off hand what this second packet should look like? I would like to find it in the stream. This issue isn't high priority for me. I just wanted to learn enough to debug my dvr's stream parser. Hoping it has the same problem. Thanks for the info. ESPN's stream has just one program with 7 ES streams in the PMT. Do you want me to close the issue?

PaulF8080 commented 2 years ago

Found the second packet packet DUH. So I will leave you alone, now.

PaulF8080 commented 2 years ago

ESPN now works on my DVR and MediaInfo. I'd like to think ESPN read this issue and fixed something. I can dream.