Multi bitrate live HLS with FFmpeg on Windows - iphone

I am trying to encode a live stream into Apple HLS for iPhone on windows. I was looking at different options and wowza can do it, but doesn't support CDN distribution of HLS as far as I can see. Plus it costs a lot of money.
What I did find was this site: http://www.espend.de/artikel/iphone-ipad-ipod-http-streaming-segmenter-and-m3u8-windows.html
I can now set up a single bitrate stream easily, but my goal is an adapive multi-bitrate live stream. Is it possible? For VOD content it can easily be accomplished with creating the different qualities then linking to them in a new m3u8, but how would this be done in live?
I can of course set up three quality live streams and link to them in an m3u8, but how will I get them GOP-aligned in this case?
My initial thought was to have one ffmpeg instance create all qualities and re-stream those outputs to new ffmpeg-instances that just remux and pipe to the segmenter. But I would need some way of streaming locally between instances. Can that be done?
If anyone has a nice solution to this, or can link to other software capable of live HLS on windows, I would appreciate any input.
Have a great day!
Regards
Carl

Just to let people know, I ended up using http://www.ioncannon.net/projects/http-live-video-stream-segmenter-and-distributor/ on a linux virtualbox and it works great. I had trouble compiling it, but there were a couple of forks that fixed those problems.

Related

Video streaming solutions

I am attempting to stream a video, in a format unity3d can access, like an mjpg. I have gone through several possible solutions, including gstreamer(only does client side as far as I could tell by the examples), yawcam(I couldn't find a way to access the image directly), and silverlight(due to simply not being able to find how the heck webcam streaming was doable) I am currently just looking for any more methods of getting video over from one side to the other. Could I possibly simply read the images into a byte array and send it over a socket? Maybe I missed something in the previous three possible solutions?
If you are looking to stream video from a server than you can use Ogg encoding + WWW.movie to map it to a texture. Assuming you have a Pro license, as I think this is a Pro only feature. If this is a local file, either bundled with the app or in external folder, we use the brilliant AVPro Windows Media or AVPro QuickTime. MJPEG does offers super smooth scrubbing with AVPro but generates enormous files. Definitely not ideal for streaming or even download!
Finally RenderHead also has a Live Camera capture plugin that could meet your needs.

Live Video Chat for iPhone and HTTP Live Streaming

So generally, I want to make an app which has video chat functionality for iPhone. But after many searches, I am still not able to find any successful results. Is there any public or even for that matter, private API available for doing this on iPhone??? If you have an YES answer, please help me.
Basically, what I want is to read the streams of the video on both the devices connected for chatting. Thanks a lot in advance and please help me if you can.
p.s - I have already checked iDoubs but it failed and always shows some unknown problem and for that reason, doesn't allow me to connect to anyone.
ALSO : The suggested method I have found is via HTTP Live Streaming. But, in that too, I have multiple doubts.
1.) I need to find how do I upload my video from iPhone to the HTTP server from where I would be broadcasting?
2.) Can you please post something related to setting up the server? How do I feed the video to the FFMPEG Server?
Mainly, I need to find the upload method. I am right now simply sending hex-code in the form of NSDATA to the server and I am stuck there. The main problem is, It is live. How do I handle that?
It would be best, if you could help me make the iDoubs work properly.
Thank you so much for any kind of support!
have a look on this how to implement video chat in iphone But before starting you must have a IMS server up & running.
here is the live video chat framework what you are looking for. Its easy and simple to implement for face to face video chat. I have already tried this. Its working very fine. Great thing about this framework is multiple platform support.
Tokbox : https://tokbox.com/platform
https://tokbox.com/opentok/tutorials/
Sample Code:
https://github.com/opentok/opentok-ios-sdk-samples/
Edit:
Here is the article explaining opentok using parse.
http://www.iphonegamezone.net/ios-tutorial-create-iphone-video-chat-app-using-parse-and-opentok-tokbox/
HTTP live streaming is primarily an approach for adaptive streaming from server-to-client. For client-to-server rather go for traditional streaming. There exists an open library for streaming, see this question.
Whilst it is possible to facetime to do two-way chat, it is not certain that you will be able to using public iOS APIs. That said, I have implemented one-way live streaming for iPhone and the difficult part was not the core streaming itself, but encoding of the payload. You will be able to do H264 in hardware and AAC / iLBC in software.
How you want to feed this to the FFMPEG depends on your transport, possibly changing from 'file' H264 frames to 'streaming' H264. Check out the H264 frame types if you implement frame dropping; reconfiguring the H264 encoder on-the-fly is not possible to my knowledge, but restarting with fresh parameters typically does not take more than a second or so.
Did you attempt to play back a live resource while capturing? That is a good starting point. If you come across an open API for H264 encoding, please post it here ;-)

iPhone: HTTP live streaming without any server side processing

I want to be able to (live) stream the frames/video FROM the iPhone camera to the internet. I've seen in a Thread (streaming video FROM an iPhone) that it's possible using AVCaptureSession's beginConfiguration and commitConfiguration. But I don't know how to start designing this task. There are already a lot of tutorials about how to stream video TO the iPhone, and it is not actually what I am searching for.
Could you guys give me any ideas which could help me further?
That's a tricky one. You should be able to do it, but it won't be easy.
One way that wouldn't be live (not answering your need, but worth mentioning) is to capture from the camera and save it to a video file. see the AV Foundation Guide on how to do that. Once saved you can then use the HTTP Live Streaming segmenter to generate the proper segments. Apple has applications for Mac OSX, but there's an open source version as well that you could adapt for iOS. On top of that, you'd also have to run an http server to serve those segments. Lots of http servers out there you could adapt.
But to do it live, first as you have already found, you need to collect frames from the camera. Once you have those you want to convert them to h.264. For that you want ffmpeg. Basically you shove the images to ffmpeg's AVPicture, making a stream. Then you'd need to manage that stream so that the live streaming segmenter recognized it as a live streaming h.264 device. I'm not sure how to do that, and it sounds like some serious work. Once you've done that, then you need to have an http server, serving that stream.
What might actually be easier would be to use an RTP/RTSP based stream instead. That approach is covered by open source versions of RTP and ffmpeg supports that fully. It's not http live streaming, but it will work well enough.

Streaming live H.264 video via RTSP to iphone does work! w/example

Using FFMPEG, Live555, JSON
Not sure how it works but if you look at the source files at http://github.com/dropcam/dropcam_for_iphone you can see that they are using a combination of open source projects like FFMPEG, Live555, JSON etc. Using Wireshark to sniff the packets sent from one of the public cameras that's available to view with the free "Dropcam For Iphone App" at the App Store, I was able to confirm that the iphone was receiving H264 video via RTP/RTSP/RTCP and even RTMPT which looks like maybe some of the stream is tunneled?
Maybe someone could take a look at the open source files and explain how they got RTSP to work on the iphone.
Thanks for the info TinC0ils. After digging a little deeper I'v read that they have modified the Axis camera with custom firmware to limit the streaming to just a single 320x240 H264 feed, to better provide a consistent quality video over different networks and, as you point out, be less of a draw on the phone's hardware etc. My interest was driven by a desire to use my iphone to view live video and audio from a couple of IP cameras that I own without the jerkiness of MJPEG or the inherent latency that is involved with "http live streaming". I think Dropcam have done an excellent job with their hardware/software combo, I just don't need any new hardware at the moment.
Oh yeah, I almost forgot the reason of this post RTSP PROTOCOL DOES WORK ON THE IPHONE!
They are using open source projects to receive the frames and decoding in software instead of using hardware decoders. This will work, however, this runs counter to Apple's requirement that you use their HTTP Streaming. It will also require greater CPU resources such that it doesn't decode video at the desired fps/resolution on older devices and/or decrease battery life compared to HTTP streaming.

flv stream decoding, 3gp encoding

Are there any open source projects in any language and other recourses that I need to look at in order to implement flv to 3gp conversion? It's better to be streaming, I mean return first portion of 3gp before last portion of flv is downloaded.
Or are there any similar services already implemented - my goal is to have something like
http://converter.org?source=sourceUrl.flv&targetFormat=3gp that I can feed to 3gp player, in my case - on iPhone, and not wait until server downloads entire flv.
UPDATE: ffmpeg does really good job here, just
ffmpeg -i input.flv output.mp4
and that's it. But output file can be used only after conversion is done. Streaming is still an open question. There is ffserver that does some sort of streaming but I could not make it work.
I'm not sure if it is possible, but if there's one thing that should do it.
it's http://www.ffmpeg.org/ ..
it can convert anything to anything on an online platform. don't know if it supports streaming but definitely the best solution for online video conversion
Well this one might be a little late to the party but to stream video online you'll need a Media Streaming Server to deliver the video over a specific streaming protocol (i.e. HTTP,HTTPS,RTSP,RTMP). I've also been looking for such a "real-time" transcoding service but the closest thing I've found so far is the Video CDN's which are quite pricy, and also limited in formats/support. What would be really nice is for one of the media servers to add in a real-time transcoding feature. At the time of this writing no such service exists that I know of.
The top 10 most popular options for Media Streaming Servers are (IMHO):
VideoLAN - VLC Media Player (good for quick tests and proof-of-concept)
Kaltura - Open Source video platform
Real Media - Helix Universal Streaming Server (may be best bet for 3GP over RTSP)
Apple - Darwin Streaming Server / Quicktime (Live) Broadcaster (best for iPhone/iPad)
Red5 - Open Source Flash Streaming Server
Adobe - Flash Streaming Server
Wowza - Media Server
FluMotion - Open Source Multimedia Streaming
Microsoft - Windows Media Server (AVI, WMV, Silverlight & other formats)
FreeCast - An OGG Theoris (video) and OGG (audio) streaming/conversion platform
As you can see there are many options for streaming and you can start as simply as hosting the video on the same server and delivering to Desktop computer browsers via HTTP (the easiest way to get started with this is trial & error). Each offers different features in terms of protocols supported and transcoding, but none are truly real-time as you mention where you could feed in a source video and get an output video in the format of you choosing (i.e. 3GP). My personal choice would be to start with VLC for small-scale tests on a home network, since it is basically a swiss-army knife for desktop video that can also act as a server for any of the formats it can playback (though it may be more complicated to get this to stream to the public internet and even harder to go all the way to a single device on a private carrier network, some info is available from people who've tried):
http://forum.videolan.org/viewtopic.php?f=4&t=45782
Some basic transcoding instructions to go to MP4 (required for iPhone/iPad/iPods):
http://wiki.videolan.org/MPEG-4
I also agree about FFMPEG being by far the best solution for video conversion, as it also supports 3GP and you can at least start playing around with conversion on your own test server, you might want to try the following PHP Classes project:
http://www.phpclasses.org/package/5977-PHP-Manipulate-video-files-using-the-ffmpeg-program.html
In my experience that was an excellent contribution to speed web interaction with FFMPEG's mostly command-line and sometimes clunky interface. Who knows, maybe you'll build the first real-time transcoding service, I'd be the first to signup as a customer and/or as a contributor to help you on that!