Play .ts video file on Android?

回眸只為那壹抹淺笑 提交于 2019-12-23 09:59:44

问题


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. :)


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/5156274/play-ts-video-file-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!