androidtransport-stream

How do I demux MP2TS in Android?


Is there an Android Java API for getting raw section and PES/ES data from an MP2TS?

MediaExtractor seems to be geared towards e.g. MP4 track/sample based formats and has no features for transport streams.


Solution

  • I can now definitively say that no such API exist - at least up to Android 7.

    This is furthermore supported by the fact that Google's own Exoplayer implements transportstream parsing in software, to play HLS MPEG2-TS media:

    https://github.com/google/ExoPlayer/tree/release-v2/library/src/main/java/com/google/android/exoplayer2/extractor/ts

    Note that the MediaPlayer class may be able to play transport streams, but this is only required for HLS and RTP sources, according to the CDD: https://source.android.com/compatibility/7.1/android-7.1-cdd.pdf