MJPG camera to hlssink

Nicolas Dufresne nicolas at ndufresne.ca
Sun Nov 19 18:15:39 UTC 2017


Le dimanche 19 novembre 2017 à 10:16 -0500, Jerry Geis a écrit :
> > 
> > gst-launch-1.0 souphttpsrc location=http://192.168.1.104/mjpg/video
> > .mjpg is-live=true '!' decodebin '!' rtpjpegdepay '!' videoconvert
> > '!' h264parse '!' queue '!' mpegtsmux '!' hlssink playlist-root=htt
> > ps://192.168.1.18/~silentm/hlssink
> > location=/home/silentm/public_html/hlssink/hlssink.camera.0.%05d.ts target-duration=1 max-files=3 playlist-length=2 playlist-location=/home/silentm/public_html/hlssink/playlist.camera.0.m3u8
> > 
> > 
> > 
> 
> Hi  Nicolas,
> Your are right. I verified with -vvv that its multipart image JPEG
> from the stream.
> I am still not certain how to change the pipe to take that and
> convert to h264 for hlssink? Can you provide a example?
> Thanks!

So, what you want to do is receive, demux, decode from jpeg, encode to
H264, mux into transport stream (TS) and then pass on the hlssink. So
something similar to:

  souphttsrc ! multipartdemux ! jpegdec ! h264enc ! mpegtsmux ! hlssink

That's nearly a pipeline, but then you need to pick your H264 encoder
(h264enc is not a plugin), and the element is something that will vary
per installation. If you have a fully GPL installation (or personal
installation), you could use the very good encoder called x264enc (from
gst-plugins-bad). Touch aspect is to pick the params you want, here's
something that should generally work, but quality may be poor, play
with the bitrate to improve.

  ... ! x264enc tune=zerolatency bitrate=... ! ...

If you have Intel hardware, and the VAAPI plugins installed, you could
use your hardware:

  ... ! vaapih264enc bitrate=.. ! ...


If you have NVidia hardware, and NVENC plugins (from gst-plugins-bad)
installed (not completely sure of the name for this one):

  .. ! nvh264enc ?? ! ...

If you have a PC and your distro has adhere to ship the completely free
OpenH264 Cisco encoder:

  .. ! openh264enc ! ...

On RPi platforms, or many other OMX base boards:

  .. ! omxh264enc ! ...

On mainline supported ARM platforms (e.g. Qualcomm, Exynos, IMX.6), you
could try your luck with (requires git master, upcoming 1.14):

  .. ! v4l2h264enc ! ...

And there is countless other options, parameters, also CODEC you could
consider.

regards,
Nicolas


More information about the gstreamer-devel mailing list