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
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.
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.
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.
Libstagefright has support for mpeg2ts (see on Android JellyBean framewroks/av/media/libstagefright/mpeg2ts)
It is supported from GingerBread (i guess).
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.
Related
I am working on a project which requires a player to play iptv which comes in .ts links
I used vitamio player but it loads the link as entities and close after only 23 second
So my approach is to playvthe link again in onCompleteListener, it works fine but after complete it takes a long time to load the next entity of the link and play it and so on.
The question is what is best free player sdk to run ts and iptv links for android?
Usually, the TS segments for a stream will be indexed in a manifest file as part of HLS or MPEG-DASH steaming protocols, although DASH typically uses fragmented mp4 rather than TS.
You can see examples of this with the example HLS manifests that apple provides in the HLS documentation online (https://developer.apple.com/library/content/technotes/tn2288/_index.html):
#EXTM3U
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10.0,
http://example.com/movie1/fileSequenceA.ts
#EXTINF:10.0,
http://example.com/movie1/fileSequenceB.ts
#EXTINF:10.0,
http://example.com/movie1/fileSequenceC.ts
#EXTINF:9.0,
http://example.com/movie1/fileSequenceD.ts
#EXT-X-ENDLIST
ExoPlayer (https://github.com/google/ExoPlayer) will play this type of stream - you provide it the manifest file (e.g. myStream.m3u8) file as the source, rather than the individual TS segments.
If you look in the demo app 'media.exolist.json' in the assets folder you will see it includes a HLS example.
You can see how it parses the HLS manifest in the 'HlsPlaylistParser' class.
I am trying to build an app that streams videos via hls and need to support subtitles up till now I am testing my app on .srt files.
I have seen google's library Exoplayer but it has some complex installation then found an exoplayer wrapper "ExoMedia" which worked perfectly except that it is not supporting subtitles. Then I decided to add the support in Exomedia which worked well but the encoding of .srt file has some issues (some turkish characters appear as ؟ when trying to read as iso or � when trying to read as utf-8).
So I have been wondering if there is an already built library that supports subtitles and http streaming.
EDIT
The subtitle problem was that Exoplayer only supports UTF-8 encoded subtitles and the srt file I was supplying was not UTF-8 encoded
My client do have 10000+ audio songs on a server, he does want to develop an iPhone and Android app to play those songs. He is willing to convert the audio files for any given format.
So what is the best format store those files on the server to consume in iOS and Android ?
OGG is the best I've used so far on both Android and iOS.
Here's the list of libraries for this for other platforms as well.
The best format used by many well known streaming sites like SoundCloud is:
-> 128kbps transcoded mp3
Everything you need to stream is preferred to be in 128kbps transcoded mp3.
Hope that help somebody.
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).
I have explored the following options:
libstagefright and OpenMax : A playback engine implemented by Google from Android 2.0.
It has a MediaExtractor is responsible for retrieving track data and the corresponding meta data from the underlying file system or http stream. But according to this post Adding video codec to Android 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:
An overview of Stagefright player
Android’s Stagefright Media Player Architecture
Custom Wrapper Codec Integration into Android
How to integrate a decoder to multimedia framework
Compiling and using FFMPEG: A complete, cross-platform solution to record, convert and stream audio and video. We can demultiplex ts files with this library as mentioned here:
FFmpeg - Extracting video and audio from transport stream file (.ts).
But I am not sure if I will be able to extract the ID3 tags from the HLS Stream. libavformat might be able to do this but I still need to come up with a mechanism for signaling the read metadata to my application.
Compiling vlc for android: I have compiled vlc for android 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.
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:
Is it even possible to create a demultiplexer from scratch that will work on android?
If possible then ,how to go about it ?
Any options that I have missed?
I am new to this. Any help would be greatly appreciated..Thanks
In android, there is a support to extract ID3 tags. Please refer to ID3 module for further details.
Integration of ID3 into MP3 extractor can be found here.
From a quick check, I have found that ID3 is supported from Froyo onwards.
I am pretty new at streaming video, so please bear with me. :)
I am trying to port an m3u8 stream over from iPhone to Android. Looking in the m3u8 feed, I found some .ts files. From what I can tell, .ts files are, themselves, wrappers that contain the video stream (Elementary Stream).
Is it possible to play a .ts file in Android? (The docs only list 3gp and mp4 as supported formats.)
Is there a way to extract the Elementary Stream and just process the video feed? If that is in 3gp or mp4, I should be ok.
Will Stagefright handle .ts? Is Stagefright even available? I read that there are/were some problems with it.
(As a further caveat, I am not getting much help from my server guys. They are pushing for a Flash player solution, including a proprietary player. They will not provide me with a 3gp or an mp4 feed, but I'm hoping I can find that in the .ts file.)
I'm open to other suggestions. Thanks for your patience with this newbie. :)
There is a standard for that called HTTP Live Streaming. Android 3.0 supports this protocol to some extent which means you can pass the URL of the m3u8 playlist to the MediaPlayer and the player should be able to stream it over HTTP. Stagefright is bundled with Android 3.0.
You can browse its source code here.
Also, this thread might interest you: it summarizes support for HTTP Live Streaming.
Android stagefright in Gingerbread and prior versions does not support playback of .ts (transport stream) or elementary stream. As you have rightly pointed out, it only supports MP4/3GP/MP3 file formats.
You can play .ts video file in android by using NDK based project. Dolphine player is best open source player for android and also supports various formats of video.
You got the .ts link from m3u file. Now you can fetch binary data from .ts file and store this binary data in file, then play this file by using video player.