Giter Club home page Giter Club logo

dumpts's Introduction

Terminology

  • TS: transport stream, the file extension is normally .ts, .tts, .m2ts, .mts
  • ISOBMFF: ISO-based Media File Format, the file extension is normally .mp4, .mov, m4a, m4v, .m4s, .heif, .heic
  • Matroska: a multimedia container format based on EBML (Extensible Binary Meta Language), the file extension is normally .mkv, .mka, .mk3d and .webm
  • MMT: MPEG Media Transport stream, the file extension is normally .mmts

What is DumpTS?

DumpTS is a simple utility tool to process the multimedia files packed into main-stream multimedia container formats, which provides these kinds of features:

  • Extract and repack the elementary stream data or PSI sections data from TS, ISOBMFF, Matroska and MMT/TLV file
  • Show media information of elementary streams, ISOBMFF box, Matroska EBML element and MMT/TLV packet/message/table/descriptors.
  • Re-factor a TS stream file in place
  • Extract some elementary streams, and reconstruct a partial TS file
  • Provide some utility features for ISOBMFF file reconstruction
  • Provide some utility functions for codec and container technology, for example, Huffman Codebook, CRC, container layout...

How to build?

  • Windows
    1. VS2015/vc14
      Open build/DumpTS_vc14.sln and build it
    2. VS2017/vc15
      Open build/DumpTS_vc15.sln and build it
  • Linux
    Make sure gcc with modern C++11/14 support is installed
    Here are steps to build and install this application
    git clone https://github.com/wangf1978/DumpTS.git
    cd DumpTS/build/linux
    make
    cd ../../bin/linux/
    ./DumpTS --help
    
  • MacOS
    Make sure clang with modern C++11/14 support is installed
    Here are steps to build and install this application:
    git clone https://github.com/wangf1978/DumpTS.git
    cd DumpTS/build/macos
    make
    cd ../../bin/macos/
    ./DumpTS --help
    

(*) both x64 and x86 are supported

How to run it?

Usage: DumpTS.exe MediaFileName [OPTION]...

Option Value Description
--output filename the output dumped file path
--pid 0xhhhh the PID of dumped TS stream, or the packet_id of dumped MMT asset
--trackid xx the track ID of a ISOBMFF/Matroska file
--CID xx the context ID of a header compressed IP packet in MMT/TLV stream
--destpid 0xhhhh the PID of source stream will be replaced with this PID
--srcfmt ts, m2ts, tts,
mp4,
mkv,
huffman_codebook,
aiff,
mmt
the source media format, Including: ts, m2ts, mp4, mkv and huffman_codebook,if it is not specified, find the sync-word to decide it.
BTW:
mp4:
it is for the ISOBMFF, for example, .mov, .mp4, .m4s, .m4a, .heic, .heif...
mkv:
it is for Matroska based file-format, for example, .mkv, .webm...
huffman_codebook:
the VLC tables
aiff:
AIFF or AIFF-C
mmt:
The MMT/TLV stream
--outputfmt ts, m2ts,
pes,
es,
wav, pcm,
binary_search_table
the destination dumped format, including: ts, m2ts, pes, es and so on
binary_search_table:
generate the binary search table for Huffman VLC codebook
--stream_id 0xhh the stream_id in PES header of dumped stream
--stream_id_extension 0xhh the stream_id_extension in PES header of dumped stream
--removebox xxxx remove the box elements in MP4 file
--boxtype xxxx For ISOBMFF/mp4 source:
the box type FOURCC, i.e. --boxtype=stsd
For Matroska/mkv source:
the EBML ID, i.e. --boxtype=0x1A45DFA3
--crc crc-type, all Specify the crc type, if crc type is not specified, list all crc types, if 'all' is specified, calculate all types of crc values
--showinfo N/A print the media information of elementary stream, for example, PMT stream types, stream type, audio sample rate, audio channel mapping, video resolution, frame-rate and so on
--showpack N/A Show packs in the specified TS/MMT/TLV stream file
--showpts N/A print the pts of every elementary stream packet
--listcrc N/A List all CRC types supported in this program
--listmp4box N/A List box types and descriptions defined in ISO-14496 spec
--listmkvEBML N/A List EBML elements defined in Matroska spec
--dashinitmp4 filename the initialization MP4 file to describe the DASH stream global information
--VLCTypes [ahdob][ahdob][ahdob] Specify the number value literal formats, a: auto; h: hex; d: dec; o: oct; b: bin, for example, "aah" means:
Value and length will be parsed according to literal string, codeword will be parsed according as hexadecimal
--verbose 0~n print more message in the intermediate process

Here are some examples of command lines:

  • Show TS information

    DumpTS 00001.m2ts --showinfo
    Program Number: 1, program_map_PID: 0X100(256).
    Program(PID:0X0100)
            Stream#0, PID: 0X12A1, stm_type: 0X90 (Unknown)
            Stream#1, PID: 0X1100, stm_type: 0X83 (Dolby Lossless Audio)
            Stream#2, PID: 0X1011, stm_type: 0X24 (HEVC Video)
            Stream#3, PID: 0X12A0, stm_type: 0X90 (Unknown)
            Stream#4, PID: 0X1015, stm_type: 0X24 (HEVC Video)
    

    it will show the PAT and PMT informations of 00001.m2ts

  • Show TS elementary stream media and codec information

    DumpTS 00001.m2ts --pid=0x1100 --showinfo
    Dolby Lossless Audio Stream information:
            PID: 0X1100.
            Stream Type: 131(0X83).
            Sample Frequency: 48000 (HZ).
            Bits Per Sample: 24.
            Channel Layout: 7.1ch(L, C, R, Ls, Rs, Lrs, Rrs, LFE).
    Dolby Lossless Audio Stream information:
            PID: 0X1100.
            Stream Type: 131(0X83).
            Sample Frequency: 48000 (HZ).
            Bits Per Sample: 24.
            Channel Layout: 7.1ch(L, C, R, Ls, Rs, Lrs, Rrs, LFE).
            Bitrate: 4202.683 mbps.
    

    It will show the elementary audio stream information, including channel layout, sample frequency and so on

  • Dump ES stream from TS/M2TS file

    DumpTS 00001.m2ts --output=00001.hevc --pid=0x1011 --srcfmt=m2ts --outputfmt=es --showpts  
    

    It will dump a hevc es stream with PID 0x1011 from the m2ts stream file: 00001.m2ts, and print the PTS of every frame.

  • Change the PID value for the specified ES

    DumpTS test.ts --output=00001.m2ts --pid=0x100 --destpid=0x1011 --srcfmt=ts --outputfmt=m2ts  
    

    It will re-factor the file: test.ts, and replace the PID 0x100 with 0x1011 in TS pack and PSI, and convert it to a m2ts

  • Dump ES stream with PID and stream_id_extension from a TS/M2TS file

    DumpTS 00022.m2ts --output=00022.mlp --pid=0x1100 --srcfmt=m2ts --outputfmt=es 
    --stream_id_extension=0x72  
    

    It will dump a MLP sub-stream from 00022.m2ts with the PID 0x1100 and stream_id_extension in PES: 0x72

  • Remove the specified MP4 Box(es)

    DumpTS test.mp4 --showinfo --removebox='unkn'
    

    Show the MP4 file box layout, and remove box with type 'unkn'

  • Dump sample data of the specified track from MP4 stream

    DumpTS tes.mp4 --output=test.hevc --trackid=1 --outputfmt=es
    

    Dump the track#1 of test.mp4, and save its sample data to the file test.hevc with NAL annex-b byte stream format, the VSP, SPS and PPS will be merged into elementary stream data.

  • Show Box information

    DumpTS test.mp4 --trackid=1 --boxtype=stsd --showinfo
    

    Show the 'stsd' box information, for example, HEVC/AVC resolution, chroma, bit-depth and so on

  • Show WebM media and codec information

    DumpTS av1.webm --showinfo
    

    Show the tree view for the EBML elements of av1.webm

  • Extract block data of the specified track from WebM file

    DumpTS tearsofsteel_4sec0025_3840x2160.y4m-20000.av1.webm --trackid=1 --output=tearsofsteel_4sec0025_4K.av1
    

    Extract av1 video stream from .webm file

  • Show MMT/TLV container inforamtion

    DumpTS 00301.mmts --showinfo
    

    Show the MMT payload information, including PLT, MPT and asset/elementary information

  • Show data fields of each TLV/IPv4/IPv6/MMT/message/table/descriptor/MPU/MFU

    DumpTS 00301.mmts --showpack
    

    Show the detailed information for MMT packets, payloads, messages, tables and descriptors

  • Extract ES data from MMT/TLV file

    DumpTS 00301.mmts --CID=0 --pid=0x100 --output=e00301.hevc
    

    Extract the HEVC stream from header compressed IP packet with context_id: 0 and MMT packet id: 0x100 from 00301.mmts

  • Other utilities

    DumpTs AACScalefactorHuffmanCodebook.txt --VLCTypes=aah --showinfo --srcfmt=huffman_codebook
    

    Load huffman-codebook from the specified file, and print its huffman-tree

    DumpTs AACScalefactorHuffmanCodebook.txt --VLCTypes=aah --srcfmt=huffman_codebook --outputfmt=binary_search_table
    

    Load huffman-codebook from the specified file, and print binary search table for huffman-tree

dumpts's People

Contributors

wangf1978 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.