简体   繁体   中英

Stream video from the server . {iPhone SDK}

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.

The iPhone does not support all streaming video formats.

You should start by reading HTTP Live Streaming Overview

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM