Stream video from the server . {iPhone SDK}

旧城冷巷雨未停 提交于 2019-12-24 09:49:39

问题


I'm trying to stream video with static IP : http://38.117.88.148/GemTVLink via iPhone. Can you show me some information as to how I could implement this? I see an apple video stream app but it seems it can show only .mp4 movies? Am I right? I want my app to load the HTTP address and play the movie, that's it. This link works on media player.


回答1:


The iPhone does not support all streaming video formats.

You should start by reading HTTP Live Streaming Overview




回答2:


iOS native video player (AVPlayer, MPMoviePlayerViewController ...) can stream from http server in m3u8 format.

I looked at the link, that you mentioned(GemTVLink), it's an mms stream, iOS can not stream from microsoft streaming servers (mms), if you want to do that, you should use ffmpeg library, as this library can connect any streaming server (supporting rtsp, mms, tcp, udp ,rtmp ...) and then draw pictures to the screen.. (for drawing you can use opengles or uiimage also works)

First of all, use avformat_open_input to connect to your ip address then use avcodec_find_decoder & avcodec_open2 to find codecs and to open them (you should call them for both audio & video)

Then, in a while loop read packets from server by using av_read_frame method When you get frame, if it is audio then sent it to AudioUnit or AudioQueue, if it is video, then convert it from yuv to rgb format by using sws_scale method and draw the picture to the screen.

That's all.

look at this wrapper also (http://www.videostreamsdk.com), it's written on ffmpeg library and supports iOS



来源:https://stackoverflow.com/questions/2217191/stream-video-from-the-server-iphone-sdk

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