Raspberry Pi 2 v4l2src 'lost frames detected' and high processor usage

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

Raspberry Pi 2 v4l2src 'lost frames detected' and high processor usage

Mandar Joshi
Hello everyone,
I am facing lots of "lost frames detected" warnings and high processor
usage when trying to stream video using GStreamer 1.10.0 and
gst-omx-1.10.0 from a USB UVC webcam (Logitech C310) on a Raspberry Pi
2.

All the warnings say:
0:00:20.129632492  1728   0xfb7000 WARN                 v4l2src
gstv4l2src.c:849:gst_v4l2src_create:<v4l2src0> lost frames detected:
count = 1 - ts: 0:00:19.660174909

and the processor usage on the Raspberry Pi 2 spikes to 70% once I
start to view the stream from a Linux box on the local network.

The commands I use are:

$ GST_DEBUG=3 gst-launch-1.0 v4l2src !
video/x-raw,width=1280,height=720,format=I420 !  omxh264enc !
rtph264pay ! shmsink socket-path=/tmp/logitech

$ GST_DEBUG=3 ./test-launch "( shmsrc do-timestamp=true
socket-path=/tmp/logitech ! application/x-rtp,clock-rate=90000 !
rtph264depay ! rtph264pay config-interval=1 name=pay0 pt=96 )"
192.168.1.202

$ GST_DEBUG=3 gst-launch-1.0 rtspsrc
location=rtsp://192.168.1.202:8556/test ! decodebin ! xvimagesink

I've attached the complete output of gst-launch-1.0 v4l2src in the
warnings.txt file attached with this email.

Any pointers on what might be going wrong?

Thanks
Mandar Joshi

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

warnings.txt (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Raspberry Pi 2 v4l2src 'lost frames detected' and high processor usage

Nicolas Dufresne-5

Le 4 nov. 2016 6:57 AM, "Mandar Joshi" <[hidden email]> a écrit :
>
> Hello everyone,
> I am facing lots of "lost frames detected" warnings and high processor
> usage when trying to stream video using GStreamer 1.10.0 and
> gst-omx-1.10.0 from a USB UVC webcam (Logitech C310) on a Raspberry Pi
> 2.
>
> All the warnings say:
> 0:00:20.129632492  1728   0xfb7000 WARN                 v4l2src
> gstv4l2src.c:849:gst_v4l2src_create:<v4l2src0> lost frames detected:
> count = 1 - ts: 0:00:19.660174909
>
> and the processor usage on the Raspberry Pi 2 spikes to 70% once I
> start to view the stream from a Linux box on the local network.
>
> The commands I use are:
>
> $ GST_DEBUG=3 gst-launch-1.0 v4l2src !
> video/x-raw,width=1280,height=720,format=I420 !  omxh264enc !
> rtph264pay ! shmsink socket-path=/tmp/logitech

First, you should probably add a queue between the capture and the encoder, that will slightly reduce the contention.

The, you should try (not sure if that work on this platforms) to use on encoder buffer to save a copy. That can be tried with v4l2src property, io-mode=userptr
(No guaranty).

>
> $ GST_DEBUG=3 ./test-launch "( shmsrc do-timestamp=true
> socket-path=/tmp/logitech ! application/x-rtp,clock-rate=90000 !
> rtph264depay ! rtph264pay config-interval=1 name=pay0 pt=96 )"
> 192.168.1.202
>
> $ GST_DEBUG=3 gst-launch-1.0 rtspsrc
> location=rtsp://192.168.1.202:8556/test ! decodebin ! xvimagesink
>
> I've attached the complete output of gst-launch-1.0 v4l2src in the
> warnings.txt file attached with this email.
>
> Any pointers on what might be going wrong?
>
> Thanks
> Mandar Joshi
>
> _______________________________________________
> 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: Raspberry Pi 2 v4l2src 'lost frames detected' and high processor usage

Mandar Joshi
Thank you for your response.

>
> First, you should probably add a queue between the capture and the encoder,
> that will slightly reduce the contention.
>
Did that. Helped a little bit.

> The, you should try (not sure if that work on this platforms) to use on
> encoder buffer to save a copy. That can be tried with v4l2src property,
> io-mode=userptr
> (No guaranty).
>
io-mode=userptr gives me an "allocator error". Output attached. (userptr.txt)

I did 3 more things,
1. Reduce input resolution from 1280x720 to 640480
2. Downgrade to kernel 4.1.13-v7+
3. Set v4l2src's io-mode to mmap

There are fewer errors now. but the "lost frames warning does pop up
once every few seconds. However 1280x720 always results in 100% CPU
usage.
640x480 around 25% CPU

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

userptr.txt (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Raspberry Pi 2 v4l2src 'lost frames detected' and high processor usage

Mandar Joshi
> There are fewer errors now. but the "lost frames warning does pop up
> once every few seconds. However 1280x720 always results in 100% CPU
> usage.
> 640x480 around 25% CPU

I did "modprobe uvcvideo nodrop=1 timeout=1000"

This gets rid of the "lost frames" warnings most of the times.

CPU usage is still high. Most of the time it is 100% but it hovered
around 75% couple of times.
I tested the camera on my desktop (i7 4770). It utilizes 20% CPU. So,
I guess the problem is not related to Raspberrry PI 2 but is about
high CPU usage when capturing video at high resolution over USB.

Any comments?
How can I reduce CPU usage when capturing video from a USB camera?

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

Re: Raspberry Pi 2 v4l2src 'lost frames detected' and high processor usage

Nicolas Dufresne-5
Le lundi 07 novembre 2016 à 14:39 +0530, Mandar Joshi a écrit :

> I did "modprobe uvcvideo nodrop=1 timeout=1000"
>
> This gets rid of the "lost frames" warnings most of the times.
>
> CPU usage is still high. Most of the time it is 100% but it hovered
> around 75% couple of times.
> I tested the camera on my desktop (i7 4770). It utilizes 20% CPU. So,
> I guess the problem is not related to Raspberrry PI 2 but is about
> high CPU usage when capturing video at high resolution over USB.
>
> Any comments?
> How can I reduce CPU usage when capturing video from a USB camera?
USB capture is always a fullscreen copy. Now we should try and find a
way to avoid a second copy. But for that, I think you need to rebuild
gst-plugins-good without libv4l2 support, I think this is was prevents
you from using io-mode=userptr. It may also be due to a too old kernel
(you need a really recent kernel).

Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (188 bytes) Download Attachment