Convert RTSP stream to HTTP Live Stream

Asked

Viewed 2,134 times

9

How do I convert RTSP stream to HTTP Live stream?

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

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

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

1 Safari HTML5 Audio and Video Guide

  • 2

    See if the links below can help you: http://stackoverflow.com/questions/2370742/convert-rtsp-video-stream-to-http-stream https://wiki.videolan.org/Documentation:Streaming_howto/Command_line_examples/

  • Your desktop is osx?

  • Yes, Thiago. Yosemite.

  • http://stackoverflow.com/questions/13660113/how-to-convert-rtsp-streaming-to-http-live-streaming-using-lighttpd

1 answer

1

As mentioned, one can make it work with VLC or ffmpeg. I don’t know exactly the commands to use them, so I’ll give a third option: Gstreamer

Check if your OS has any installation package for Gstreamer (I believe it doesn’t have for OS/X), if you don’t have it 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 you execute correctly then everything is fine. Otherwise, it may be that the version you installed does not support the format used or you bumped into some bug. You can report to http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

Having executed 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 want. 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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.