Set buffer rate MPMoviePlayerController - iphone

My app was recently denied because it is set to stream 60+ mb files from my web server and play them; the MPMoviePlayerController downloaded the entire file in 5-10 minutes while simultaneously playing it. From the testing perspective, the app worked great, but Apple limits audio streaming to 5mb/5min.
How would I go about limiting the buffer rate to only buffer 5mb/5min?
I have no idea which direction to go. I am willing to overhaul as long as the player can still stream the files from my web server.
All replies are appreciated.

Live Streaming is limited due to cellular network limits, so the only way to do this is to do this:
Google "HTTP Live Streaming"
Download the tools from Apple's Dev Center and install them
You will need to use Terminal to mediafilesegment the flies
mediafilesegmenter /Path\ to\ File/Name.mp3
Then upload the .m3u8 files and the segments to your server (same directory) and stream the m3u8. Problem solved!

Related

Flash Media Server live streaming with multiple video files

I am using Flash Media server 4.5 and i read the tutorial if i want to stream the live feed, i may need to use the media live encoder. but what i found in media encoder is i have to manually setup everything and it only support camera devices.
But in my case i have multiple video files keep received from another program, my goal is use the Flash Media server to perform a live boardcasting with these video file one by one.
That means when client watching the streaming, they will not notice the server is play mov1, then mov2, then mov4, then mov5... and so on.
Also can FMS dynamically create a new streaming session (invoke by code), so that when client A uploading some video files to the server, the FMS open a new streaming session only stream cilent A video files?
Can FMS achieve such purposes? any tutorial provided would be very helpful!
Edit for Open Bounty
I want to basically deliver a live stream of video where a list of videos are source. I am currently using Flash Media Server with Cloudfront CDN to deliver content. So if I have video1, video2, and video3. I want to play them back to back as a live stream (so no skipping ahead in video), is it possible to do this? Bounty goes to clever workaround. Think of this as a television channel.
i have been working on the live streaming technologies for the past 1and half year . There is no option in flash live encoder for any file encoding.
1.To encoder your file you can use your dvd player devices or some thing else which supports usb devices playback options.and use the dvd player output to broadcast using flash media live encoder.
2.And the another set is to setup windows media encoder that supports file encoding(no need od dvd player) but it supports only windows media services.
At present i live webcast video file in this way only for my company http://www.malar.tv/live.php

iPhone MPMoviePlayerController : download files while streaming en play them locally

I've m3u8 file with all the TS files. MPMoviePlayerController play them fine via http request on the streaming server. But I'd like to get the files locally in order to play them again later without any connection.
I managed to download m3u8 file and all the TS files locally on my device, I edited m3u8 files to point to local .ts instead of http ones, but I can't read them from this emplacement.
(VLC can do it well)
Is there a way to download the segments while playing (to avoid 2 downloads) and then to play them locally with MPMoviePlayerController or else.
.m3u8 is Apple HTTP Live Streaming, right? I think what you're trying to do simply goes against the design of that technology. You should expose the original file and allow it to be downloaded.
From what I understand, it's in the design of streaming that you don't get explicit access to the pieces in order to put them back together. For instance, Netflix uses streaming via Silverlight, and one of the benefits (to Netflix) is that it protects the data from being saved as if it were downloaded. Also, since HTTP Live Streaming allows a stream to switch bitrates on the fly, it's designed such that each time slice can be encoded at any number of bitrates, and none of them is canonical.
In theory, there might be a way to collect all the slices for a particular bitrate and re-encode them into a single video. But Apple's playback APIs are not going to give you that opportunity.
Instead of HTTP Live Streaming, consider progressive download. Just serve the original video file (transcode it to something the iPhone likes if necessary). If your server is configured properly, the playback APIs will do small requests to get particular chunks of the file, rather than the whole thing in one go, and it's a close second to proper streaming. I wish I could find where I read about this so I could give the proper name for it. Amazon S3 is set up to serve this way, if you need a quick solution.
But beware, Apple's docs say,
If your app delivers video over
cellular networks, and the video
exceeds either 10 minutes duration or
5 MB of data in a five minute period,
you are required to use HTTP Live
Streaming. (Progressive download may
be used for smaller clips.)

streaming video FROM an iPhone

I can get individual frames from the iPhone's cameras just fine. what I need is a way to package them up with sound for streaming to the server. Sending the files once I have them isn't much of an issue. Its the generation of the files for streaming that I am having problems with. I've been trying to get FFMpeg to work without much luck.
Anyone have any ideas on how I can pull this off? I would like a known working API or instructions on getting FFMpeg to compile properly in an iPhone app.
You could divide your recording to separate files with a length of say, 10sec, then send them separately. If you use AVCaptureSession's beginConfiguration and commitConfiguration methods to batch your output change you shouldn't drop any frames between the files. This has many advantages over frame by frame upload:
The files can be directly used for HTTP live streaming without any server side processing.
The gap between data transfers allow the antennas to sleep in between if the connection is fast enough, saving battery life.
Conversely, if the connection is slow so upload is slower than recording, managing delayed upload of a set of files is much easier than a stream of bytes.

I'm implement http live streaming video from my webserver to iPhone. Will I get rejected for bandwidth?

Apache webserver setup
added:
AddType application/x-mpegURL .m3u8
AddType video/MP2T .ts
to "httpd.conf" file.
Movie file preparation
I have 3 movie files (9mb - 25mb each).
Used QuickTime to convert movies into iPhone format.
Used mediafilesegmenter to convert .m4v into 10-second segments of .ts files, with an accompanying .m3u8 file.
Placed these in a folder on webserver.
iPhone App implementation
Created UIWebView whose URL points to http://71.190.235.29/~yujean/stream.html
Simulator accesses the site and streams the movie-files just fine.
Question
Will I still get rejected by apple for bandwidth issues over the 3G and/or Edge network?
Do I need to somehow check which network the end-user is on first? And then provide a different movie accordingly? If so, how do I do that ...?
Thank you in advance,
Eugene
We were rejected when we first submitted our mp3 streamer to the app store for excessive bandwidth use. Then we hobbled the app to limit its downloads to 4.5 meg in 5 min, which was accepted by Apple.
You can review that thread for more info on the issue.
To answer your second bullet-point first, the SDK does that all for you. Determining what quality to stream is not the concern of the developer.
To answer your first bullet-point, I haven't submitted my Live Streaming app so I don't know for sure, but I believe you will be rejected if you don't have a 64k stream. To be sure, check out Requirements for Apps, which is as definitive a list of requirements that you could probably get.

Simultaneously stream and save a video?

I'm writing an app, part of which allows the user stream/play videos. I want to restrict the functionality so that they can only stream videos if they have a WiFi connection. I will then save the video so that when they have a 3G only (or lesser) connection they can't stream videos and can only replay videos that are saved on the phone.
Ideally, I'd like to get MPMoviePlayerController to stream/play the movie and then access the movie data and save it. However, the MPMoviePlayerController api doesn't seem to support access to the movie data.
I'd like to avoid and download-then-play scenario. Any ideas?
Two solutions come to mind.
Both this solutions require that the file is in a format that can be played progressive, e.g. that you don't need the whole file to be able to play it (but that would be a prerequisite anyway).
use a thread to download the data and append it to a file, and play the file from another thread. Now, that requires that you can handle EOF events in the MPMoviePlayerController and pause the playing until the cache file is appended to and then resume for the same point.
So far what I've seen people doing this it doesn't work because MPMoviePlayerController can't handle the EOF event. (not tested it my self yet) [Caching videos to disk after successful preload by MPMoviePlayerController
Skip the playing from a file and setup a local HTTP server and stream from that (on localhost). This is also not tested.
The idea is that MPMoviePlayerController would handlle the event of missing data better from a HTTP stream then from reading the file directly.
Downside might be that it is less efficient, but I think that is a minor increase in CPU. I don't know if the network interface would handle it, but I'm assuming it's not an issue.
I leave this answer as a wiki, because I don't have a working solution but I too want one.
There is a way to make this work, but you have to write your own HTTP Live Streaming downloader.
Basically, you parse the .m3u8 file (it's a pretty simple standard, but can get tricky with alternate streams and the possibility that the stream will simply drop out and need a new playlist to continue) and then download the chunks in .ts format to your local storage, say the Documents folder or Caches etc.
Then you'll have to set up a local HTTP server to allow the MPMoviePlayerController or AVPlayer to access the files over HTTP (since they won't touch a local file path), including a re-coded playlist file pointing to the local files, which you'll have to create yourself from the original playlist(s).
CocoaHTTPServer works great for this.
Once you've done all that, it works great. It's unavoidable that you get a little delay while you download the first chunk or two before presenting your local HTTP URL to the movie player, but after that you get seamless download, recording and preview playback.
Good luck!
the iPhone is using progressive download so it will not save on the device. For that you need to explicitly download it and then play the video from your local folder.