I'm trying to receive a live RTP audio stream in my iPhone but I don't know how to start. I'm seeking some samples but I can't find them anywhere.
I have a Windows desktop app which captures audio from the selected audio interface and streams it as µ-law or a-law. This app works as an audio server that serves any incoming connection with that streaming. I have to say that I've developed an Android app that receives that stream and it works, so I want to replicate this functionality on iOS. In Android we have "android.net.rtp" package to manage this and transmit or receive data streams over the network.
Is there any kind of equivalent package for iOS to implement this? Could you give me any kind of reference / sample to do this, or just tell me where to start?
You can see this libraryHTTPLiveStreaming, But his protocol maybe is not standard one, You can check my fork aelam/HTTPLiveStreaming-1, I'm still working on it, it can be played by ffplay. You can try
check the file rtp.c in ffmpeg, I think it will help out
Related
I’m obtaining H.264 video from a DJI drone in an Android library I wrote. From there the video is distributed via WebRTC to many subscribers. This works.
Now one came to the idea if it would be possible to have an RTMP stream aside, so that a parallel publishing of the video to platforms like YT or FB would be possible.
I integrated the code which does H.264 to FLV to RTMP and it works perfectly with at least two open source solutions I have tested: OSS/SRS (https://github.com/ossrs/srs) and node-media-server (https://github.com/illuspas/Node-Media-Server). I publish to instances running here in my LAN and view that by VLC. That works fine.
It doesn’t work if I publish to YT directly. Then I thought I try to insert restream.io into the chain. But it also does not work reliably. Restream at least is a bit more chatty regarding what’s happening, but not chatty enough: What I see is, that I can connect and disconnect - the dashboard window reacts promptly. Same as YT does. I see that the RS dashboard shows bitrate, frame rate and key frame rate and the statistics confirms that. Just - the screen remains black (as with YT) and there is just this spinning wheel.
I can exclude, that I have any kind of weird firewall problem, since I can perfectly uploading H264 as FLV stream using FFMPEG from the command line.
So what is the state: I have two open source RTMP servers, which tell me, all is fine. I have two major public RTMP servers, which don’t say much, but don’t confirm that it works either…
I'm looking for some hints to find out, what is wrong with my stream :)
The simple reason was: YT REQUIRES audio. My stream didn't contain any audio. So I multiplexed a silent fake audio stream into the upload and it worked.
I have read about HTTP Live Streaming from Apple. So far I understand that it was created for streaming video to iOS devices. But is it possible to use this approach to stream from iOS device while recording on camera? If so can you give me a clue or tell how to do it?
It is possible, yes. But I would not recommend it. HLS is a pull based protocol. Good for delivering to clients, but bad for ingesting. Would need to run a web server on the device, and package the media into a transport stream. Its a lot of effort that is easier to handle on the server.
I have to record the high volume sound. It can be upto 60 seconds. The application is already made on flash and the current flash application uses rtmp (red5 server) and streams the recording to the server in real time as FLV. I have uploaded the audio file on server as mp3 from iOS application but this approach is not useful as the volume is very high as mentioned above. So I want to use rtmp (red5 server) for iOS application. I want to ask is it possible that I can record the audio and upload on this server and also can steam from there?
Edit-1: I want to ask that whether Apple can reject the application if we use the RTMP iOS library in our application?
Edit-2: I did some research and found some 3rd party libraries like:
http://www.aftek.com/afteklab/aftek-iphone-RTMP-library.shtml
I want to know, whether it is possible to directly connect from iOS to RTMP server?
Or these libraries use the middle layer approach with HTTP to connect to RTMP?
Example: iOS -> HTTP Server -> RTMP Server (red5)
I will appreciate the help.
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.
I want to be able to record footage using my iOS device and stream it directly to a server.
There's quite a few articles on S.O. that talk about this, but I'm not sure any have answered the question very well.
Should I be using HTTP Live Streaming, or is this just for sending data to an iPhone?
Should I be using AVCaptureSession to grab the video (a segment at a time?), sending each segment to the server?
Should I be using AVCaptureVideoDataOutput and ffmpeg for streaming?
I'm a little lost with all this, so any sample code or docs or links would be really appreciated.
Thanks for your help guys.
Duncan
You have to choose a network protocol for that purpose and find an appropriate media server to receive and process the stream. If the RTMP format is ok for your project, check angl library which supports RTMP streaming from iOS. Currently it's compatible with iOS 6 and 7.