Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP live streaming with ios

My app is rejected by apple and they give a reason

We found that your app does not use the HTTP Live Streaming protocol, with a baseline stream of 64 kbps, to broadcast streaming video

Then I search for a solutions and over internet all the solutions suggest that I have to use .U8F8 and .ts extension for live streaming but my app has mp4 format. I already used MPMoviePlayerController for streaming.

So my question is:

  1. Do I have to convert mp4 video to M8U8?
  2. Do I have to use MPMoviePlayer?
  3. Can I convert mp4 video to M8U8 format during run-time and how to implement live streaming
  4. Is there any example code available for HTTP live streaming?

Thanks in advance.

like image 438
Nikh1414 Avatar asked Jul 25 '12 05:07

Nikh1414


People also ask

Can you live stream on iOS?

Live stream an app using iOS ReplayKit Open the app you want to stream. Open the Menu for live streaming, and select YouTube. Follow the steps to set up your stream. Tap Go Live.

What is Apple HTTP Live Streaming?

HTTP Live Streaming (HLS) sends audio and video over HTTP from an ordinary web server for playback on iOS-based devices—including iPhone, iPad, iPod touch, and Apple TV—and on desktop computers (macOS).

What is the best live streaming app for iOS?

Streamlabs is the best free video streaming app for creators. Live stream mobile games, your phone screen, or broadcast your camera to share your IRL experiences to social platforms such as Twitch, YouTube, Facebook, and more!


2 Answers

I can only comment on pre-recorded video, not live streaming...

Do I have to convert mp4 video to M8U8?

I think you mean .m3u8. Basically, you need to take your .mp4 file and:

  1. Encode it to a friendly bitrate for mobile bandwidths. You can use Apple's Compressor* app for this, it has presets for HTTP Live Streaming. Pick something around 1000kbps if you're playing around.

  2. Slice it up the output using Apple's mediafilesegmenter. You'll end up with lots of small .ts files and a manifest (.m3u8) which lists them.

  3. Hit the .m3u8 file in your player (initWithContentURL...) and you're off.

  4. Repeat steps 1 and 2 above and specify differing bandwidths. We went for the presets in Compressor.

  5. You'll end up with different versions of your video, 1 for each bandwidth, use the variantplaylistcreator tool from Apple to create a master playlist file which will point your player to each bandwidth so it can switch automatically.

  6. Stick all your .ts files and .m3u8 files on the net and use the mediastreamvalidator tool to check your master playlist file is ok and points to each version correctly.

Make sure a decent quality bitrate is first in the master playlist file as this is the version that's played first. We went for something around the 1000kbps mark.

Do I have to use MPMoviePlayer?

I can't comment on other libraries, we used MPMoviePlayer.

Can I convert mp4 video to M8U8 format during run-time and how to implement live streaming

You can for live streams but for pre-recorded video do it all before. Put all your files online, validate your playlist (.m3u8) and play your videos using the master .m3u8 file.

Is there any example code available for HTTP live streaming?

In our implementation the client in iOS does all the work (e.g. switching streams depending on the available bandwidth). As such you just need to make sure all your files are in the right place before hand.

Compressor - https://www.apple.com/final-cut-pro/compressor/ The mediafilesegmenter and mediastreamvalidator tools command lines tools available to download from the Apple developer network site.

These articles have everything you need to know: https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html https://developer.apple.com/library/archive/technotes/tn2288/_index.html#//apple_ref/doc/uid/DTS40012238

Open this up in Safari: https://developer.apple.com/streaming/examples/advanced-stream.html - Each 'Gear' is a different bitrate stream

Crack open this .m3u8 file in a text editor for an example master playlist file: https://devimages.apple.com.edgekey.net/resources/http-streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8

like image 178
hemal Avatar answered Oct 18 '22 14:10

hemal


If your MP4 file is more that 10 minutes in length you will need to use HLS to stream the file.
For live streams, you can use software like this to encode it live: http://www.mcommstv.com/products/mcomms-transcode

If it's a VoD file then pre-encode it with your favourite H.264/AAC encoder.

Remember to include multiple bitrate versions of your file, including 64kbps. If you don't include a 64kbps stream Apple will reject the App. We commonly use: 64k 120k 240k 480k 800kbps 1200kbps The bitrate that you list first in your multirate m3u8 file will be played for the first 30 seconds, put a medium bitrate first so it doesn't take too long to start streaming when users are on slow 3G networks. Here's an example:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=120000
120k/Playlist.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=60000
60k/Playlist.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=240000
240k/Playlist.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=480000
480k/Playlist.m3u8
like image 23
Grant Avatar answered Oct 18 '22 14:10

Grant