TS File Demux

TS File Demux will extract/demux various streams such as ES, PES, sections, DSM-CC data and object carousels (like MHP, HbbTV and SSU) and partial TS from a MPEG2 Transport Stream to separate files. The extracted files can then be used for input in other software, i.e. analyzing applications. TS File Demux is ideal for R&D labs that work with MPEG2 Transport Streams. TS File Demux is used internally for development of DVBStreamExplorer application. Besides stream extraction, several CSV report files are created containing details about h.262, PCR, OPCR, PTS, DTS and more.


Using TS File Demux

  • Specify MPEG2 Transport Stream file for input. Selected file will be scanned for PAT and PMT tables and populate the program tree wih program information. The program tree will include PID values for CA EMM/ECM, PMT, PCR and all streams found in the programs. Selected file will be scanned for unique PID values and PID list will be populated. A folder for output files will be suggested based of the imput file name.
  • Specify folder for output files if the default one suggested is not acceptable.
  • Select ‘Produce ‘clean’ TS file’ option to prouce a clean TS file. The file will be saved as ‘clean.ts’ in the selected output folder.
  • Add ES, PES, Section and PID to single file filters. Filter parameters can be specified manually. It’s also possible to double-click on entries in program tree with a PID value to populate filter paramater controls. For ES filters there is the option to create extended CSV reports in output folder for H.262 (MPEG-2 video) streams. These reports include detailed usage of picture_start_code, slice_start_code, user_data_start_code, sequence_header_code, sequence_error_code, extension_start_code, sequence_end_code, group_start_code packets. One report contains count of all packet types for each H.262 stream. Another CSV report will be created for each ES H.262 binary file. It will contain list of all packets found ordered by occurrence in file.Alternatively you can quickly add filters for all PID values found in program tree using ‘Add all’ button. However this will give you less control on how each filter is added. Elementary streams carrying PES packets are added both as PES and ES filters. Streams carrying sections are added as ‘split by table_id’ filters. All other PID values are added as ‘Single PID one file’ filters.
  • Select ‘Split PES/ES files on TS packet continuity error’ to split PES/ES files whenever there is a continuity error in TS packet. File name of each split file is derived from base file name with .001, .002 etc. appended. Each split file segment should contain a continuous sequence of PES/ES packets.
  • Select ‘Produce partial TS file by either including or excluding unique PID’s from source file’ to produce a partial TS from the source. You can select multiple PID values from ‘Unique PID’s in source TS’ list and add in one go to include/exclude list. Then select to either save only PID streams included in list or save all PID streams except those in the list. You can right-click on any item in program list containing a PID value to activate a context menu that allows you to add that PID value to include/exclude list. You can right-click on any program item in program list to activate a context menu that allows you to add all PID values in the program to include/exclude list. Use the option ‘Replace excluded packets with null packets (0x1fff)’ to replace excluded TS packets with a null packet. The output file will be the same size as the input file (more correctly same size as file produced with ‘Produce ‘clean’ TS file’ option) This should preserve validity of PCR timestamps, which is required for some applications. The file will be saved as ‘ts_partial.ts’ in the selected output folder.
  • Start splitting by applying ‘Start’ button. A dialog showing the progress of splitting will appear. Extracted streams will be saved in folder spefied for output files. File names for saved files are auto-generated based on filter parameters like type, PID and table_id where applicable. Three files sectionreport.csv, pesreport.csv and esreport.csv will be generated in output folder. These will contain a small report for section, PES and ES filters. For each PID follwoing information will be included: Total number of PES/ES packets or sections delivered; number of PES/ES packets or sections skipped due to continuity error at TS level; Total number of bytes delivered.

Filter types

  • Clean TS. This will save a TS that has multiple number of TS packets (each packet 188 byte), with each packet starting with a sync (0x47) byte. This can be used to produce ‘clean’ files for use with applications that are strict about input file. Note: This will not do any cleanup/repair of TS packet content.
  • PES. This will save Packetized Elementary Stream including PES headers.
  • ES. This will save Packetized Elementary Stream excluding PES headers (PES packet data bytes only). It’s possible to specify both PES and ES filters for a given PID.
  • Section. It’s possible to save all sections on the specified PID to a single file. It’s also possible to automatically split sections on the specified PID into separate files based on table_id. At last it’s also possible save only sections with a specified table_id. This can be i.e. raw PSI, SI, PSIP, CA EMM/ECM, DSM-CC, MPE, etc. sections.
  • DSM-CC. This will save DSM-CC data and object carousels. It is possible to specify DSM-CC and section filters on the same PID. Data carousels are saved in dc\[pid]\[download_id] folder. Object carousels are saved in oc\[pid]\[download_id version] folder.


    This feature is designed for DVB carousels. It may not work as expected for carousels other than DVB.

  • Single PID one file. Save a file of TS packets containing just the specified PID.
  • TS payload. Save a file containing the payload only of TS packets for the specified PID. Adaptation field is not saved if present.

Other resources

See an example of how TS File Demux can be used to extract CA ECM/EMM streams here Extracting CA EMM/ECM sections with TS File Demux.
See an example of how TS File Demux can be used to discover table_id in section section streams here Discover section table_id with TS File Demux