RSPI 4 and Cam streaming

Nicolas Dufresne nicolas at ndufresne.ca
Thu Aug 27 14:31:33 UTC 2020


Le jeudi 27 août 2020 à 03:28 -0500, DejanCotra a écrit :
> HI all,
> 
> I have 3 devices.
> RSPI 4 with Gstreamer 1.16.2.
> Laptop Windows 7 and Gstremer 1.16.2.
> Laptop Ubuntu 18.04 Gstremer 1.14.5.
> 
> from RSPI 4 I stream camera with:
> gst-launch-1.0 v4l2src device=/dev/video0 ! v4l2convert ! queue !
> v4l2h264enc ! video/x-h264,profile=constrained-baseline ! h264parse !
> rtph264pay config-interval=-1 name=payloader pt=96 ! udpsink host=IP_ADDRESS
> port=9000

You might want to control few things on the encoder. What the encoder
support is HW specific, you can get a list with:

  v4l2-ctl -d /dev/videoX -l

Then setting controls happens like this:

  v4l2h264enc extra-controls=s,bitrate=1000000 ! ...

For documentation of the possible controls:

  https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-codec.html

Notably check your HW default for V4L2_CID_MPEG_VIDEO_GOP_SIZE (gop-
size).

> 
> from Ubuntu do this:
> gst-launch-1.0 -v udpsrc port=9000 caps='application/x-rtp,
> media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' !
> rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

It's recommended to add an rtpjitterbuffer with a configured latency.
That will allow smoother playback (if you revert to sync=true of
course).

> 
> And I can see my camera stream just fine but only if I add
> config-interval=-1 without that its not working.

If the Pi4 HW supports it,
see V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR control. This is
basically the same thing. It's not uncommon to use this mode, it's not
the default for backward compatibility reason.

> 
> However if I run same line as Ubuntu on Windows:
> gst-launch-1.0 -v udpsrc port=9000 caps='application/x-rtp,
> media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' !
> rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
> 
> I can not see camera stream (with or without config-interval=-1 set).
> 
> What could be a problem here? Do I need some additional parameters to
> configure on sender/receiver side when streaming to Windows?

It could be a  regression from 1.14 to 1.16, but also could also be the
difference between OS (like socket buffer-size, see udpsrc property).
It could also be a timing issue if your HW produced open gop (never
insert IDR). Try and enable some debugging, it may help.

GST_DEBUG=3 gst-launch-1.0 ...

> 
> Dejan
> 
> 
> 
> 
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list