Skip to content

Eyevinn/mp2ts-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test golangci-lint GoDoc Go Report Card license

mp2ts-tools - A collection of tools for MPEG-2 TS

MPEG-2 Transport Stream is a very wide spread format for transporting media.

This repo provides some tools to facilitate analysis and extraction of data from MPEG-2 TS streams.

Tools

mp2ts-info

mp2ts-info parses a TS file or stream on stdin and prints information about the video streams in JSON format. Use this for quick stream analysis and metadata extraction.

Example:

mp2ts-info video.ts

mp2ts-nallister

mp2ts-nallister shows detailed information about NAL units including:

  • PTS/DTS timestamps
  • Picture types (I, P, B frames) for both AVC and HEVC
  • PicTiming SEI messages
  • RAI (Random Access Indicator) markers
  • SMPTE-2038 ancillary data

Options:

  • -waitps - Wait for parameter sets (SPS/PPS) before printing NAL units
  • -sei - Print detailed SEI message information
  • -smpte2038 - Print SMPTE-2038 ancillary data details
  • -max N - Limit output to N pictures

Example:

mp2ts-nallister -waitps -max 10 video.ts

mp2ts-pslister

mp2ts-pslister shows information about parameter sets (SPS, PPS, and VPS for HEVC) in a TS file. Useful for debugging video codec configurations.

Example:

mp2ts-pslister video.ts

mp2ts-extract

mp2ts-extract extracts elementary video streams (PES payloads) from TS files to raw Annex B byte stream format. By default, it waits for parameter sets (VPS/SPS/PPS) before starting extraction to ensure a clean, decodable stream.

Features:

  • Supports both AVC (H.264) and HEVC (H.265) streams
  • Auto-selects first video PID or extract specific PID
  • Outputs Annex B byte stream format
  • Waits for parameter sets by default

Options:

  • -output <file> - Output file path (required, use - for stdout)
  • -pid N - PID to extract (0 = auto-select first video PID)
  • -waitps - Wait for parameter sets before extraction (default: true)

Examples:

# Extract first video stream to file
mp2ts-extract -output video.264 input.ts

# Extract specific PID
mp2ts-extract -pid 512 -output video.hevc input.ts

# Output to stdout
mp2ts-extract -output - input.ts > video.264

How to run

You can download and install any tool directly using

> go install github.com/Eyevinn/mp2ts-tools/cmd/mp2ts-info@latest

If you have the source code you should be able to run a tool like

> cd cmd/mp2ts-info
> go mod tidy
> go run . h

Alternatively, you can use the Makefile to build the tools or make a coverage check. The Makefile will set the version depending on the Git commit used.

Commits and ChangeLog

This project aims to follow Semantic Versioning and Conventional Commits. There is a manual ChangeLog.

License

MIT, see LICENSE.

Support

Join our community on Slack where you can post any questions regarding any of our open source projects. Eyevinn's consulting business can also offer you:

  • Further development of this component
  • Customization and integration of this component into your platform
  • Support and maintenance agreement

Contact sales@eyevinn.se if you are interested.

About Eyevinn Technology

Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor. As our way to innovate and push the industry forward we develop proof-of-concepts and tools. The things we learn and the code we write we share with the industry in blogs and by open sourcing the code we have written.

Want to know more about Eyevinn and how it is to work here. Contact us at work@eyevinn.se!

Packages

No packages published

Contributors 3

  •  
  •  
  •