Using iPhone as input for media segmentation - HTTP Live Streaming

I started working on the HTTP live streaming protocol and felt very interesting. Passed the full document provided by Apple.

I tried Vedio On Demand and Live Streaming, and also used the VLC player as a streaming server, following the steps in one of the developer forums, and I can successfully test it.

Now I want my iPhone to be a streaming source and want to use another iPhone to view this content.

As already mentioned, a mediastreamsegmenter is a tool that accepts an MPEG-2 transport stream through a UDP network connection or from sdtin.

Can someone tell me a little about how to start using my iPhone as a streaming server and is capable of transmitting content. As far as I know, I think there should be a client application (iPhone) that sends content to a server, which, in turn, converts the stream to an MPEG-2 transport stream and sends it to the media server. I hope the rest will be the same as for the VLC player.

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

+4
source share
2 answers

This is just my guess . I tried not to publish this if there is a positive answer. However, there is still no answer. Therefore, I am writing this to share my opinion. However, I am sorry that this is not so.

If you just want to transfer video from iOS devices, it's easy. Just send the video file. Therefore, I assume that you want to stream live video. The transfer of what I am currently recoding.

I thought about this problem a few weeks ago, however I could not succeed. The problem is not in the multimedia segment. MPEG2 TS is just a container, and segmentation is just video splitting, it can be easily implemented (?) With an exact specification.

The real problem is video encoding. iOS does not offer compressed live feed from camera input. (maybe more?) The compressed stream can only be saved to disk. There must be a method to get the compressed video stream inside. Because FaceTime is impossible without it. However, it is not provided to third parties.

This allows you to constantly store short videos and upload them to the server. But initiating / ending a video session takes too much time. Therefore, I abandoned this method.

In another way, iOS offers an uncompressed video stream, so you can do this by compressing the raw video stream. With ffmpeg or such things. However, Apple's video encoding uses hardware features to improve performance (this can improve video quality in a smaller size) and save energy. ffmpeg does everything only in software. Of course, you can make your own hardware accelerator or purchase it from any supplier.

There are great streaming video apps on the market. I have not used them. But perhaps one of them.

  • transfer raw frames. (no compression or fast but weak compression)
  • ffmpeg encoder.
  • independent implementation of hardware accelerator.

At first, too much bandwidth is required, and also consumes heavy energy.

The second is certainly slow and consumes heavy energy. However, this may be sufficient.

The third needs too much development cost for small applications. But if you have enough budget, it will be very good. I don’t know, I know that a pre-implemented library for iOS exists on the market.

I want Apple to release such a compressed video stream. What was compressed by hardware accelerator with Apple hardware accelerator. But perhaps this will not happen if Apple does not decide to abandon the protection of the high-quality video streaming function between devices as a killer function ... FaceTime.

However, perhaps Apple will release this API in some time. And I'm not sure I was looking for all the APIs. Perhaps I could not verify something important.


Update

I found the AVAssetWriter class that can write video data to a compressed file. This may be the key to creating such an application.

+2
source

Here is a good example of AVAssetWriter and AVAssetReader in Video Encoding using AVAssetWriter - CRASHES . You can read the part for sending collected data online.

0
source

Source: https://habr.com/ru/post/1342979/


All Articles