Logitech C270 to RTP

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Logitech C270 to RTP

marininpa
Hi, I have a task to transmit a video stream from a USB WEB camera (Logitech
C270) over the RTP protocol. The WEB camera is connected to the Raspberry
pi. I'm using pipeline " gst-launch-1.0 v4l2src device=/dev/video0 !
'image/jpeg,width=1280,height=720, framerate=30/1' ! rtpjpegpay ! udpsink
host=127.0.0.1 port=5602 sync=false", but in this case I get too high
bitrate, 12-13 Mbit. How to transform the pipeline to reduce the bitrate to
1.5-2 Mbit and not to load the Raspberry pi processor too much?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Logitech C270 to RTP

Nicolas Dufresne-5
Hi,

Le ven. 16 avr. 2021 16 h 15, marininpa <[hidden email]> a écrit :
Hi, I have a task to transmit a video stream from a USB WEB camera (Logitech
C270) over the RTP protocol. The WEB camera is connected to the Raspberry
pi. I'm using pipeline " gst-launch-1.0 v4l2src device=/dev/video0 !
'image/jpeg,width=1280,height=720, framerate=30/1' ! rtpjpegpay ! udpsink
host=127.0.0.1 port=5602 sync=false", but in this case I get too high
bitrate, 12-13 Mbit. How to transform the pipeline to reduce the bitrate to
1.5-2 Mbit and not to load the Raspberry pi processor too much?

The RPi has an h264 encoder capable of that. On very old RPi, you can use omxh264enc, on newest PI and distribution, the encoder is v4l2h264enc. An example pipeline would be (untested):

gst-launch-1.0 v4l2src ! jpegparse ! v4l2jpegdec ! queue ! v4l2h264enc output-io-mode=dmabuf-import extra-controls=s,bitrate=1500000 ! video/x-h264,profile=constrained-baseline,level=4 ! rtph264pay ...

I'm not sure if RPi jpeg decoder actually works, and if dmabuf-import works on this platform, je replace with software decoder and no import if it fails. The h264 level probably need to be constrained to the rate/resolution, I know this driver does not take care and will happily fail instead.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel hi

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Logitech C270 to RTP

GStreamer-devel mailing list
Hello!
I did it with the omxh264enc codec.
This pipeline works: "gst-launch-1.0 -v v4l2src device=/dev/video0 !
video/x-raw,width=640,height=480,framerate=30/1 ! videoconvert ! omxh264enc
! rtph264pay pt=96 config-interval=1 ! udpsink host=192.168.88.100
port=5000"
I'm using a Raspberry pi 3 b+, CPU usage 10% and bitrate <1 Mbit, it's good.

But I need a resolution of 1280x720 and with this resolution the pipeline
does not work:
"gst-launch-1.0 -v v4l2src device=/dev/video0 !
video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert ! omxh264enc
! rtph264pay pt=96 config-interval=1 ! udpsink host=192.168.88.100
port=5000"
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal
data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.003548594
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

How can this be fixed?




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Logitech C270 to RTP

GStreamer-devel mailing list
Le jeudi 06 mai 2021 à 03:30 -0500, marininpa via gstreamer-devel a écrit :

> Hello!
> I did it with the omxh264enc codec.
> This pipeline works: "gst-launch-1.0 -v v4l2src device=/dev/video0 !
> video/x-raw,width=640,height=480,framerate=30/1 ! videoconvert ! omxh264enc
> ! rtph264pay pt=96 config-interval=1 ! udpsink host=192.168.88.100
> port=5000"
> I'm using a Raspberry pi 3 b+, CPU usage 10% and bitrate <1 Mbit, it's good.
>
> But I need a resolution of 1280x720 and with this resolution the pipeline
> does not work:
> "gst-launch-1.0 -v v4l2src device=/dev/video0 !
> video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert ! omxh264enc
> ! rtph264pay pt=96 config-interval=1 ! udpsink host=192.168.88.100
> port=5000"
> Setting pipeline to PAUSED ...
> Pipeline is live and does not need PREROLL ...
> Setting pipeline to PLAYING ...
> New clock: GstSystemClock
> ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal
> data stream error.
> Additional debug info:
> gstbasesrc.c(3055): gst_base_src_loop ():
> /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
> streaming stopped, reason not-negotiated (-4)
> Execution ended after 0:00:00.003548594
> Setting pipeline to PAUSED ...
> Setting pipeline to READY ...
> Setting pipeline to NULL ...
> Freeing pipeline ...
>
> How can this be fixed?

Low-end cameras are may not support higher resolution and framerate due to
bandwidth limitations. You can check you camera capabilities using:

  gst-device-monitor-1.0 Video/Source

or
 
  v4l2-ctl --list-formats-ext -d0

Most likely, if 720p@30 is supported, it will be provided as jpeg, and you will
have to use jpegdec or similar element.

>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Logitech C270 to RTP

GStreamer-devel mailing list
Yes, supports only 5 or 7.5 fps

Size: Discrete 1280x720
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)


GStreamer-devel mailing list wrote
> Most likely, if 720p@30 is supported, it will be provided as jpeg, and you
> will
> have to use jpegdec or similar element.

what sequence should be in the pipeline?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Logitech C270 to RTP

GStreamer-devel mailing list
Le jeudi 06 mai 2021 à 09:15 -0500, marininpa via gstreamer-devel a écrit :
> Yes, supports only 5 or 7.5 fps
>
> Size: Discrete 1280x720
> Interval: Discrete 0.133s (7.500 fps)
> Interval: Discrete 0.200s (5.000 fps)

That's is a bit useless.

>
>
> GStreamer-devel mailing list wrote
> > Most likely, if 720p@30 is supported, it will be provided as jpeg, and you
> > will
> > have to use jpegdec or similar element.
>
> what sequence should be in the pipeline?

You mean to use jpeg ? would be v4l2src ! jpegec ! video/x-raw,...
The rest is the same.

>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Logitech C270 to RTP

GStreamer-devel mailing list
GStreamer-devel mailing list wrote
> You mean to use jpeg ? would be v4l2src ! jpegec ! video/x-raw,...
> The rest is the same.

yes, this pipeline works:
gst-launch-1.0 v4l2src device=/dev/video0 ! jpegdec !
video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert ! omxh264enc
! rtph264pay pt=96 config-interval=1 ! udpsink host=192.168.88.100 port=5000

but the CPU load has increased from 10% to 50%, are there alternative jpeg
decoders?




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel