简体   繁体   English

从服务器流式传输视频。 {iPhone SDK}

[英]Stream video from the server . {iPhone SDK}

I'm trying to stream video with static IP : http://38.117.88.148/GemTVLink via iPhone. 我正在尝试通过iPhone流式传输带有静态IP的视频:http: http://38.117.88.148/GemTVLink 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? 我看到了一个苹果视频流应用程序,但似乎只能显示.mp4电影? Am I right? 我对吗? I want my app to load the HTTP address and play the movie, that's it. 我希望我的应用程序加载HTTP地址并播放电影,仅此而已。 This link works on media player. 此链接在媒体播放器上有效。

The iPhone does not support all streaming video formats. iPhone不支持所有流视频格式。

You should start by reading HTTP Live Streaming Overview 您应该先阅读HTTP Live Streaming Overview

iOS native video player (AVPlayer, MPMoviePlayerViewController ...) can stream from http server in m3u8 format. iOS本机视频播放器(AVPlayer,MPMoviePlayerViewController ...)可以m3u8格式从http服务器流式传输。

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) 我看了您提到的链接(GemTVLink),它是一个mms流,iOS无法从Microsoft流服务器(mms)进行流传输,如果要这样做,则应使用ffmpeg库,因为该库可以连接任何流服务器(支持rtsp,mms,tcp,udp,rtmp等),然后将图片绘制到屏幕上。(对于绘制,您可以使用opengles或uiimage起作用)

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) 首先,使用avformat_open_input连接到您的IP地址,然后使用avcodec_find_decoder和avcodec_open2查找并打开编解码器(对于音频和视频,应同时调用它们)

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. 然后,在while循环中,使用av_read_frame方法从服务器读取数据包当获取帧时,如果是音频,则将其发送到AudioUnit或AudioQueue,如果是视频,则使用sws_scale方法将其从yuv转换为rgb格式并绘制图片到屏幕上。

That's all. 就这样。

look at this wrapper also ( http://www.videostreamsdk.com ), it's written on ffmpeg library and supports iOS 还要看这个包装器( http://www.videostreamsdk.com ),它是在ffmpeg库上编写的,并且支持iOS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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