4

I want to play .ts video file in my application.I am not getting any way do it. I doubt it whether it is possible to do it or not in Android.

I have heard about Stagefright framework.So please tell me how I can use Stagefright in my application & whether it is able to play a .ts file or not.

Or is there any other way to play .ts file?

Thanks

Ganesh
  • 5,790
  • 2
  • 34
  • 54
Arun Badole
  • 10,339
  • 19
  • 65
  • 93

5 Answers5

1

There are 2 frameworks in Android(Stagefright & Nu-Player)

  • For Local Playback & Progressive Download(You-Tube) - Stagefright
  • For Streaming(rtsp/HLS) - Nu-Player

Coming to TS, if it is hosted in server and if you try to stream(http:///1.ts), then it is treated as Progressive Download(PD) just like You-Tube by your Android phone.

To play a local/PD content, Stagefright loads a Parser component(MPEG2TSExtractor.cpp) to parse the TS contents. In older version, the above mentioned parser module didn't have support for Progressive Download. That's the reason playback was not successful.

In recent versions this support is added.

If you are writing an APP, then you can rely only on existing Stagefright. MXPlayer has it's own Multimedia framework to play the content.

0

I think that Android stagefright does not support playback of .ts (transport stream) or elementary stream. It only supports MP4/3GP/MP3 file formats or HLS playback(m2u8).
You can use the HLS(HTTP Live Streaming) to play your file, but you have to pass an url with this type http://xxxxxxxxxx.com/playlist.m3u8.
You have to store your .ts files in the server though. Please refer here for more details.

Lazy Ninja
  • 21,131
  • 9
  • 77
  • 99
  • Ninza Thanks for your response:) Is there any third party library for Android which can be used to play .ts file ? – Arun Badole Dec 19 '12 at 07:10
  • @AB1209, does the file has to be local? There is another way to play .ts files. See my edit. As for a third party library ffmpeg may do the job, but it is a little complex: http://stackoverflow.com/a/4820282/1503155 – Lazy Ninja Dec 19 '12 at 07:15
  • Ninza I have used .m3u8 file format for playing list of .ts files & it works fine.But I want to play an .ts file individually.It may be stored locally or on server. – Arun Badole Dec 19 '12 at 07:20
  • @AB1209 Okay. That I haven't tried yet. But I think you will have to do a lot of work in the native level(ndk) to realize it. ffmpeg could be a good lib to start with. – Lazy Ninja Dec 19 '12 at 07:31
  • Ninza I have a url for .m3u8 file which contains list of .ts files & I can easily play that file using VideoView.So indirectly VideoView is playing .ts file which is listed in .m3u8 file.So please can you guide me how I can use feature that VideoView uses to play .ts file. – Arun Badole Dec 19 '12 at 08:52
0

Libstagefright has support for mpeg2ts (see on Android JellyBean framewroks/av/media/libstagefright/mpeg2ts) It is supported from GingerBread (i guess).

Ganesh
  • 5,790
  • 2
  • 34
  • 54
0

Use GStreamer. It has support for Android, and can decode TS files.

Tutorial 5 needs a slight modification in Android.mk (in jni directory) to include TS plugins in GSTREAMER_PLUGINS:

mpeg2dec mpegdemux2 mpegtsdemux mpegtsmux

Then you are good to go. This is for mpeg2 inside the TS. Remember that TS is a container, so you will perhaps need to be specific on what codec the streams inside the TS are coded with.

barkside
  • 3,942
  • 4
  • 21
  • 31
0

StageFright has support for TS files, even though it is very limited, for starters seek is not supported.

Also it depends what video codec is being used in the TS file, StageFright implementation supports very few (only H264 i think but not sure on this). Apart from this StageFright implementation for TS files is also limited by google's TS parser implementation which is very basic too. It plays a very small subset of "possible" TS files. I say "possible" because TS standard ( ISO/IEC 13818-1) leaves a lot of room for interpretation and possibilities for encoders.