开发者

Using iPhone as input to mediastreamsegmenter - HTTP Live Streaming

开发者 https://www.devze.com 2023-02-15 14:16 出处:网络
I started working on HTTP live Streaming protocol and felt very interesting. Went through the complete document provided by Apple.

I started working on HTTP live Streaming protocol and felt very interesting. Went through the complete document provided by Apple.

I tried Vedio On Demand and Live Streaming as well using VLC player as the streaming server following the steps mentioned in one of the developer forums and I'm able to stream it successfully.

Now I want my iPhone to be the source for streaming and want to use another iPho开发者_开发问答ne to view that content.

As mentioned, mediastreamsegmenter is a tool which receives an MPEG-2 transport stream over a UDP network connection or from sdtin.

Can someone put some light as how to start to use my iPhone as the streaming server and able to stream the content. To my knowledge, I think there must be a client(iPhone) application which sends the content to the server which in turn converts the stream into MPEG-2 transport stream and sends it to the mediastreamsegmenter. I hope the remaining part is same as I did to stream for a VLC Player.

It would be great if someone can help me out as how to start on this.


This is just my guess. I tried not to post this if there is a positive answer. However, still now, there is no answer. So I'm writing this just to share my opinion. However I'm sorry this is not positive.

If you want just transferring video from iOS devices, it's easy. Just send video file itself. So I assume what you want is live video streaming. Broadcasting what I'm currently recoding.

I did thought about this problem few weeks ago, however I couldn't succeeded. The problem is not a media segmentor. MPEG2 TS is just a container, and segmentation is just splitting video, it cab be implemented easily(?) with accurate specification.

Real problem is video encoding. iOS does not offer compressed live stream from camera input. (maybe yet?) Compressed stream only can be stored into disk. There should be a method to get compressed video stream internally. Because FaceTime is impossible without it. However it does not offered to 3rd parties.

It's possible storing short videos continually and upload them to server. But initiating/completing video session takes too long time. So I gave up this method.

As another way, iOS offers uncompressed video stream, so you can make it by compressing raw video stream yourself. With ffmpeg or such things. However Apple's video encoding utilizes hardware features to increase performance (this can make video quality better within lower size) and save energy. ffmpeg does all things only in software. Of course, you can make your hardware-accelerated encoder yourself, or purchase it from some vendor.

There is some live video streaming featured apps on the market. I didn't used them. But maybe one of these.

  • transfer raw frames. (no compression or fast but weak compression)
  • ffmpeg encoder based.
  • independent hardware-accelerated encoder implementation.

First one require too heavy bandwidth, and also consumes heavy energy.

Second one definitely slow and consumes heavy energy. However it may be just enough.

Third one needs too high development cost for small scale apps. But if you have enough budget, this is most fine. I don't about know pre-implemented library for the iOS is exist on the market.

I wish Apple will release this kind of compressed video stream. Which compressed with Apple's hardware accelerated encoder. But maybe it will not happen unless Apple decide to give up protecting high-quality live video streaming feature between devices as their killer feature... the FaceTime.

However it's possible Apple release this API at some time. And I'm not sure that I searched all of APIs. It's possible I couldn't checked something important.


Update

I found the class AVAssetWriter which can write video data into file with compression. This may be key to making this kind of app.


There's a good example of AVAssetWriter and AVAssetReader at Video Encoding using AVAssetWriter - CRASHES. You can the reader part to send gathered data on network.

0

精彩评论

暂无评论...
验证码 换一张
取 消