RTSP to HTTP MJPEG transcoding embedded in website

Manuel picture Manuel · May 13, 2017 · Viewed 8.8k times · Source

I have a phone which can display http MJPEG streams, and I would like to get this working. I have a camera here, which only sends out an RTSP Stream, I could convert this with vlc to a http MJPEG stream, but my phone needs this embedded into a website.

Like this: http://88.53.197.250/axis-cgi/mjpg/video.cgi?resolution=320x240 But the vlc transcoding, just sends out the bare http stream.

Is there any chance to embedd this correct, so that I can display this on the screen? I've googled a lot, but couldn't find a solution for that.

Thank you very much

I would like to use Suse Linux to do that

Answer

Hokusai picture Hokusai · May 14, 2017

This is the command I use for converting RTSP to MJPEG with vlc:

vlc.exe -vvv -Idummy hereYourVideoSource --sout #transcode{vcodec=MJPG,venc=ffmpeg{strict=1}}:standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8080/} --run-time= hereYourTimeOutValue vlc://quit;

Change hereYourVideoSource for your RTSP source and hereYourTimeOutValue for enable a timeout of proccessing if you want.

In this sample I use port 8080 on localhost, you can change it to another port. The request to get this mjpeg should be:

http://127.0.0.1:8080/

or:

http://localhost:8080/

In html you get the mjpeg using img tag:

<img src="http://localhost:8080/" />

Hope it helps. Suerte.