How to stream live from iphone camera to server using rtsp? - ios

I am using AVCaptureSession to record a video and audio of user. I am getting real time video and audio streams independently. I am able to encode them using h264 encoder and aac encoder respectively. Now I am not getting how to multiplexing them both and make a stream ? How to send them to specific server url which is protected by userName and Password ? If it can be done using RTMP also then also it's fine.
I have taken a reference from here! But I am not getting much out from this.
Is there any RTSP library project which can help me ?
I have been struggling in it from a long.
Is there any solution to my problem ?
Thanks in advance.

Related

Re-stream a live video from iphone to a server

I am getting a video feed in my app from a drone. The drone's SDK is giving me the video as Data or NSData into my app. I want to stream the same or divert the same to a server (for example a Wowza server). These two things should process simultanously.
You can use ffmpeg library for restreaming it.
There is a sample ffmpeg swift or objective c
I've been trying to send the video to a streaming service like YouTube for a year. The video coming into the iPad from the controller (connected to a Phantom 3 Advanced) is in H.263 format. ffmpeg is best at bulk transcoding, not a stream environment. Tried https://github.com/LaiFengiOS/LFLiveKit but it has bugs. It's a wrapper on ffmpeg that knows how to do RTMP.
The DJI go app knows how to do this, I've asked in the forum for help or code sample but they won't help. Bottom line is I can find no way to stream the video from the drone to a streaming service like YouTube or Wowza. I wish Wowza could accept H.263 native, but they site list only H.264.
So I can't give you an answer, but I can give you what I've figured out over the last year.

What is the role of Streaming server like Wowza?

I have been exploring on how to live stream from iPhone. I will have to publish a stream at URL to Wowza server that I came to know. Other thing is that I will require a library for iOS to encode and compress the camera output and will have to send that stream over RTMP protocol to the Wowza server. At the receiving and, there should be a player which can decode, decompress that stream comes from the Wowza to the device like iPhone (a user who wants to see live stream).
My question is, if encoding is done through particular iOS SDK, RTMP has a role as a Protocol, a player at receiving end has a role of decoding, then what is the role of Wowza ? What is its function that makes it very important in the live streaming process ?
I have been searching on the function of a Media Streaming server since 3 days, but I could not understand the exact function of Media Streaming server like a Wowza.
I am desperate to the answer..
Any explanation will be appriciated, thanks in Advance !!!
I actually did a year-long project involving media streaming on iOS and I used Wowza. The role of Wowza is to function as a media server that can receive the video that is broadcast from an iOS device over the RTMP protocol. With Wowza, you have options to send http parameters that instruct the server to begin or stop recording the live video that is being streamed. You also have the option of embedding video players in websites for live view.

How to stream video directly recorded by iPhone camera?

I have one requirement for capturing the video and broadcast it while shooting the video.
I searched many things and found 4 steps but i don't have any suggestion for first initial steps of how to capture video and broadcast it while shooting.
I have found below steps but there is no any explanation for capturing and broadcasting video.
You can use "Wowza media Server" for Streaming purpose For wowza
media server doenload :
After installing wowza Now you need to set up live setting in wowza
for that purpose you need:
RTMP library for Streaming
So can anyone please make me understand below questions:
How to record video ?
How to broadcast video while shooting ?
Thanks in advance.

Best way to convert RTMP to MP4

I need to play an RTMP streaming in a website.
I want to run on iOS devices, but I know RTMP does not run on it.
So, my idea is to convert RTMP to some audio file (mp4, for example) and send it to the user and to play with HTML5. Do you have a better idea to do this work? I have PHP5 at server, but I have no idea about how to convert a continuous data (streaming) in a HTML5 compatible audio. For now, it's only an idea I have...
Thanks in advance.
There is currently no live format that works with html 5 . Mp4 can not be used as a live source as it is not a streaming format. The only built in support for Live audio/video on iOS is HLS.

How to display RTSP from IP Camera/CCTV in iOS

There is obviously a way to do this because so many applications are already doing it - NetCamViewer and iCamviewer to name just one.
I have searched and searched, but I'm not finding anything of value that gives a hint as to how this is done. I'm reaching out hoping that someone will give me a clue.
I'm trying to connect to an video security camera (Y-CAM), which supports the RTSP protocol, and display the video from my iPhone/iPad application. The camera has an IP address and I can view the video from a web browser and from Quicktime running on my Mac. The problem is that RSTP is not supported on iOS so even trying to connect using Safari on an iPad doesn't work.
I've read that some are trying to use Live5555, but I haven't seen an article that describes if it has been done successfully and how.
An alternative is to capture the RTSP stream on a server, convert it to an HTTP Live stream and then connect to the HTTP Live stream from iOS. Unfortunately, this hasn't proved as easy as it sounds.
I'd prefer to go directly to the camera like other applications I've seen do. the RTSP to Live is a fall back if I have to.
Any hints are greatly appreciated. Thanks!
This is wrong :) or not necessary (An alternative is to capture the RTSP stream on a server, convert it to an HTTP Live stream and then connect to the HTTP Live stream from iOS. Unfortunately, this hasn't proved as easy as it sounds.)
You should use ffmpeg library, as this library can connect any streaming server (supporting rtsp, mms, tcp, udp ,rtmp ...) and then draw pictures to the screen.. (for drawing you can use opengles or uiimage also works)
First of all, use avformat_open_input to connect to your ip address
then use avcodec_find_decoder & avcodec_open2 to find codecs and to open them (you should call them for both audio & video)
Then, in a while loop read packets from server by using av_read_frame method
When you get frame, if it is audio then sent it to AudioUnit or AudioQueue,
if it is video, then convert it from yuv to rgb format by using sws_scale method and draw the picture to the screen.
That's all.
look at this wrapper also (http://www.videostreamsdk.com), it's written on ffmpeg library and supports iOS
You really need to search stack overflow before posting , this question has been asked many times. Yes live 555 sort of works and some of us have gotten it to work..
There are other players too, including ours http://www.streammore.tv/
You can find an open source FFMepg Decoder for iOS (and somes samples) on GitHub : https://github.com/mooncatventures-group
Sample use of this library : http://sol3.typepad.com/exotic_particles/
There are two general technology to display RTSP video on iOS Safari:
RTSP / HLS (H.264+AAC)
RTSP / Websocket (H.264+AAC ==> MPEG+G.711 or H.264+?)
For HLS you can consider Wowza server.
For Websocket playback in iOS Safari you can use WCS4 server.
Main idea for websocket playback is direct HTML5 rendering to HTML page Canvas element and audio context. In the case of MPEG playback video decoding will be done on iOS Safari side using plain JavaScript.
Another option - install a WebRTC plugin with getUserMedia support and play this stream via WebRTC. Anyway you will need a server side RTSP-WebRTC transcoder in such case.

Resources