ios – Converter RTSP stream para HTTP Live Stream

Question:

How do I convert RTSP stream to HTTP Live stream?

I have an IP Camera that uses the RTSP protocol to stream video, and I would like to make it work on iOS using the Safari browser. According to the Safari 1 documentation

Safari on the desktop plays the RTSP stream, while Safari on iOS plays the HTTP Live stream.

The browser on iOS only supports the HTTP Live stream protocol. How to convert this stream?

1 Safari HTML5 Audio and Video Guide

Answer:

As mentioned, it can work with VLC or ffmpeg. I don't know exactly what commands to use them, so I'll give you a third option: GStreamer

Check if your OS has an installation package for GStreamer (I believe it doesn't have for OS/X), if not you can install it by downloading from the URL below:

http://gstreamer.freedesktop.org/download/

On a terminal, you can test if your system can decode the RTSP stream using:

gst-launch-1.0 playbin uri="<url do stream>"

If run correctly then everything is fine. Otherwise, it could be that the version you installed doesn't support the format used or you ran into some bug. You can report it at http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

Having run correctly, you now need to transcode to HLS

gst-launch-1.0 uridecodebin uri="<url do stream>" name=d ! queue ! videoconvert ! x264enc ! h264parse ! queue ! mpegtsmux name=mux ! hlssink d. ! queue ! audioconvert ! faac ! queue ! mux.

You can use gst-inspect-1.0 hlssink to see some properties you can add to hlssink and configure the HLS playlist location and other details if you like. The default will be that the files for HLS will be placed in the folder where you run the command.

Now you need to run an HTTP server to serve the generated files. The simplest would be:

python -m SimpleHTTPServer

and will start a server on port 8000, then you just point the client to http://ip.do.seu.desktop:8000/playlist.m3u8

Scroll to Top