title: Create a demultiplexer for MPEG 2 TS in android
body: <p>I have a requirement where I need to extract ID3 tags from a MPEG2 TS(HLS STREAM). MPEG2 has a limited support in android in regards to playing the file. But my concern is to extract the ID3 tags(playing the file is not necessary). Hence I am not concerned with the codecs(encoding and decoding). </p>
  
  <p>I have explored the following options:</p>
  
  <p><strong>libstagefright and OpenMax</strong> : A  playback engine implemented by Google from Android 2.0.
  It has a <a href="http://developer.android.com/reference/android/media/MediaExtractor.html" rel="nofollow noreferrer">MediaExtractor</a> is responsible for retrieving track data and the corresponding meta data from the underlying file system or http stream. But according to this post <a href="https://stackoverflow.com/questions/4678739/adding-video-codec-to-android?lq=1">Adding video codec to Android</a> I need to build my own firmware or my own media player.I am hoping I don't have to go down that path. More info on stagefright and openMax can be found here:</p>
  
  <p><a href="http://freepine.blogspot.in/2010/01/overview-of-stagefrighter-player.html" rel="nofollow noreferrer">An overview of Stagefright player</a></p>
  
  <p><a href="http://quandarypeak.com/2013/08/androids-stagefright-media-player-architecture/" rel="nofollow noreferrer">Android’s Stagefright Media Player Architecture</a></p>
  
  <p><a href="https://stackoverflow.com/questions/16034287/custom-wrapper-codec-integration-into-android?rq=1">Custom Wrapper Codec Integration into Android</a></p>
  
  <p><a href="https://stackoverflow.com/questions/15334509/android-how-to-integrate-a-decoder-to-multimedia-framework">How to integrate a decoder to multimedia framework</a></p>
  
  <p><strong>Compiling and using FFMPEG</strong>:  A complete, cross-platform solution to record, convert and stream audio and video. We can demultiplex ts files with this library as mentioned here:</p>
  
  <p><a href="https://stackoverflow.com/questions/13942424/ffmpeg-extracting-video-and-audio-from-transport-stream-file-ts">FFmpeg - Extracting video and audio from transport stream file (.ts)</a>. </p>
  
  <p>But I am not sure if I will be able to extract the ID3 tags from the HLS Stream. <em>libavformat</em> might be able to do this but I still need to come up with a mechanism for signaling the read metadata to my application.</p>
  
  <p><strong>Compiling vlc for android</strong>: I have compiled  <a href="https://wiki.videolan.org/AndroidCompile/" rel="nofollow noreferrer">vlc for android</a> and made some modifications inside the transport module in demux component for extracting the tags, but it is not able to play all the streams that I am supplying to it.</p>
  
  <p>After looking through these options , I am still at a fix in how to achieve this. I don't want to create a media player as I will not be playing the files nor do I want to build my own firmware. Using ffmpeg seems to be the most viable option, but I want to try this without using any third-party or open source library. My questions are:</p>
  
  <p>Is it even possible to create a demultiplexer from scratch that will work on android? </p>
  
  <p>If possible then ,how to go about it ? </p>
  
  <p>Any options that I have missed?</p>
  
  <p>I am new to this. Any help would be greatly appreciated..Thanks</p>