MPEG.TS

Hex.pm Version

MPEG Transport Stream (TS) library.

This library is the base of our MPEG.TS plugin for the Membrane Framework which is being battle-tested with production workloads. Checkout its code and the tests for some usage examples.

Initial table/packet parsing code was copied verbatim from https://github.com/membraneframework/membrane_mpegts_plugin.

Private PES (JSON) example

Use :PES_PRIVATE_DATA with a registration descriptor (tag 0x05) to signal custom payloads such as JSON:

alias MPEG.TS.Muxer

descriptors = [%{tag: 0x05, data: "JSON"}]
{pid, muxer} = Muxer.add_elementary_stream(Muxer.new(), :PES_PRIVATE_DATA, descriptors: descriptors)
{pat, muxer} = Muxer.mux_pat(muxer)
{pmt, muxer} = Muxer.mux_pmt(muxer)

json_payload = ~s({"type":"json","value":1})
{packets, _muxer} = Muxer.mux_sample(muxer, pid, json_payload, 0, sync?: true)

Copyright and License

Copyright 2022, KIM Keep In Mind GmbH Licensed under the Apache License, Version 2.0