Kernel Errors with 2 USB Camera and ffmpeg

Test and fix the Kernel 4.14 features
Post Reply
agju
Posts: 2
Joined: Thu Dec 20, 2018 8:55 pm
languages_spoken: english, spanish, catalan
ODROIDs: XU4
Contact:

Kernel Errors with 2 USB Camera and ffmpeg

Unread post by agju » Thu Dec 20, 2018 9:12 pm

Hi,

I'm trying to use 2 USB cameras on the Odroid XU4, plus ffmpeg on one of them to be able to both read images on the board and stream images to the internet.

Info of the board:

Code: Select all

$ uname -a
$ 4.14.87-153 #1 SMP PREEMPT Tue Dec 11 11:33:18 -02 2018 armv7l armv7l armv7l GNU/Linux
Output of lsusb -t

Code: Select all

/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=r8152, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/2p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/2p, 480M
        |__ Port 1: Dev 3, If 4, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 1: Dev 3, If 2, Class=Video, Driver=uvcvideo, 480M
        |__ Port 1: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 1: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 1: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 2: Dev 5, If 0, Class=Video, Driver=uvcvideo, 12M
        |__ Port 2: Dev 5, If 1, Class=Video, Driver=uvcvideo, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=exynos-ohci/3p, 12M
    |__ Port 1: Dev 2, If 0, Class=Communications, Driver=cdc_acm, 12M
    |__ Port 1: Dev 2, If 1, Class=CDC Data, Driver=cdc_acm, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=exynos-ehci/3p, 480M
I'm using ffmpeg and v4l2loopback to create 2 dummy /dev/videoX to recreate the input from one of the cameras to this two dummies:

Code: Select all

ffmpeg -f v4l2 -input_format mjpeg -pix_fmt yuyv422 -video_size 1280x720 -r 15 -framerate 15 -i /dev/video0 -f v4l2 -pix_fmt yuyv422 /dev/video5 -f v4l2 -pix_fmt yuyv422 /dev/video6
Until here it seems to work fine, but just when I start retrieving images from the camera with openvCV + python, I get this message in the logs and dmesg:

Code: Select all

xhci-hcd xhci-hcd.3.auto: ERROR unknown event type 37
and after a while (randomly, I'm not able to find a pattern) the camera stops working, and I have to rettach it and restart ffmpeg after getting this message like 50 times in a second:

Code: Select all

ERROR Transfer event TRB DMA ptr not part of current TD ep_index 2 comp_code 13
Looking for event-dma 00000000b693f880 trb-start 00000000b693fcf0 trb-end 00000000b693fcf0 seg-start 00000000b693f000 seg-end 00000000b693fff0
I'm a bit stucked, and I cannot find any other information regarding this issue. I've found some places that says that the "error type 37" can be ignored, but I'm not totally sure.

Any help would be appreciated!

thohtdelta
Posts: 56
Joined: Mon Jun 18, 2018 9:15 pm
languages_spoken: english
ODROIDs: ODROID XU4
Contact:

Re: Kernel Errors with 2 USB Camera and ffmpeg

Unread post by thohtdelta » Thu Dec 27, 2018 11:55 pm

Hi,

I'm using a USB 3.0 camera, facing the same issuies.

First I tried capturing camera feed and recording it to a video using Python and open-cv.
- gave me

Code: Select all

'select timeout'
error.

'dmesg' errors:

Code: Select all

[Fri Dec 21 22:18:07 2018] xhci-hcd xhci-hcd.3.auto: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 2 comp_code 1
[Fri Dec 21 22:18:07 2018] xhci-hcd xhci-hcd.3.auto: Looking for event-dma 00000000b6942710 trb-start 00000000b6942720 trb-end 00000000b6942720 seg-start 00000000b6942000 seg-end 00000000b6942ff0
[Fri Dec 21 22:20:03 2018] usb 4-1-port2: Cannot enable. Maybe the USB cable is bad?
[Fri Dec 21 22:20:03 2018] usb 4-1.2: USB disconnect, device number 3
[Fri Dec 21 22:20:04 2018] usb 4-1-port2: Cannot enable. Maybe the USB cable is bad?
I tried tracing out UVC video's dmesg errors by : "sudo echo 0xffff > /sys/module/uvcvideo/parameters/trace"
Recieved:

Code: Select all

uvcvideo: Dropping payload (out of sync).
uvcvideo: USB isochronous frame lost (-71).
Now, I'm trying to capture video feed by using FFMPEG with set bitrates, min&max rates -

Code: Select all

ffmpeg -f v4l2 -framerate 30 -video_size 320x240 -input_format mjpeg -rtbufsize 1000k -i /dev/video0 -c:v libx264 -x264opts nal-hrd=cbr:force-cfr=1 -b:v 750k -minrate 750k -maxrate 750k -bufsize 1000k NAME.mkv
It defenitely has improved my capturing efficiency, but gets interupted after some time. So, still not satisfied with the behaviour.
Couldn't understand the pattern/cause behind these errors.

What's your thought on this?

What other methods have you tried?

Did you find any improvements?

User avatar
odroid
Site Admin
Posts: 30028
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Kernel Errors with 2 USB Camera and ffmpeg

Unread post by odroid » Fri Dec 28, 2018 9:27 am

First, try shorter and thicker USB cables.

And, try to lower the UVC packet size something like "uvcvideo quirks=128" or less.
https://stackoverflow.com/questions/256 ... uvc-driver

agju
Posts: 2
Joined: Thu Dec 20, 2018 8:55 pm
languages_spoken: english, spanish, catalan
ODROIDs: XU4
Contact:

Re: Kernel Errors with 2 USB Camera and ffmpeg

Unread post by agju » Fri Dec 28, 2018 9:48 pm

Thanks!! Will try the quirk trick and will report success or not.

Also I will try to use better/thicker USB cables.

Thanks for your response

Post Reply

Return to “Linux Kernel 4.14 Debugging Party”

Who is online

Users browsing this forum: No registered users and 0 guests