问题
I have entire mux with four channels dumped in a single *.ts file. I'm demultiplexing that and I can't find any info on how to extract the resolution, framerate, codec, language, channels, etc...
Should I read macroblocks, or do something else?
Thnx.
回答1:
Here is the listing of where to look for the information:
Number of programs, their description etc. : PAT and PMT.
The number of Audio and languages and additional information : SDT, BAT etc.
Codec - refer to PES header - stream_id and look up in MPEG 2 systems standard.
Resolution, and frame rate, 4.2.0/4.2.2 - sequence header in MPEG 2 video elementary stream.
Bitrate - you can only estimate by counting number of packets(x 188bytes) between two PCR packets and the PCR distance.
Append your question for more specific fields.
回答2:
If you are just demultiplexing, it suffices to read the PAT and PMT and split the streams based on their PIDs, and create new PATs and PMTs for the streams.
Something like gstreamer or vlc may be helpful as it already has a lot of code for manipulating transport streams.
来源:https://stackoverflow.com/questions/4240806/transport-stream-extracting-information