Failed to initialize linux tool Capture process failed with code 1

Hey, i’m trying to run edge-impulse-linux on balenaOS and I get this error Failed to initialize linux tool Capture process failed with code 1

Let me share more here:

root@8f2dea9fb62c:/usr/src/app# edge-impulse-linux
Edge Impulse Linux client v1.2.5

[SER] Using microphone hw:0,0
[SER] Using camera mmal service 16.1 starting...
Failed to initialize linux tool Capture process failed with code 1

and i have tested 2 cameras (CSI and USB) with this information:

Device found:

        name  : USB Camera-B4.09.24.1
        class : Video/Source
        caps  : video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=(fraction){ 60/1, 50/1, 40/1, 30/1, 15/1 };
                video/x-raw, format=(string)YUY2, width=(int)320, height=(int)240, framerate=(fraction){ 187/1, 150/1, 137/1, 125/1, 100/1, 75/1, 60/1, 50/1, 37/1, 30/1 };
                video/x-bayer, format=(string)grbg, width=(int)640, height=(int)480, framerate=(fraction){ 60/1, 50/1, 40/1, 30/1, 15/1 };
                video/x-bayer, format=(string)grbg, width=(int)320, height=(int)240, framerate=(fraction){ 187/1, 150/1, 137/1, 125/1, 100/1, 75/1, 60/1, 50/1, 37/1, 30/1 };
        properties:
                udev-probed = true
                device.bus_path = platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4:1.0
                sysfs.path = /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/video4linux/video1
                device.bus = usb
                device.subsystem = video4linux
                device.vendor.id = 1415
                device.vendor.name = "OmniVision\\x20Technologies\\x2c\\x20Inc."
                device.product.id = 2000
                device.product.name = "USB\ Camera-B4.09.24.1"
                device.serial = OmniVision_Technologies__Inc._USB_Camera-B4.09.24.1
                device.capabilities = :capture:
                device.api = v4l2
                device.path = /dev/video1
                v4l2.device.driver = ov534
                v4l2.device.card = "USB\ Camera-B4.09.24.1"
                v4l2.device.bus_info = usb-0000:01:00.0-1.4
                v4l2.device.version = 328787 (0x00050453)
                v4l2.device.capabilities = 2233466881 (0x85200001)
                v4l2.device.device_caps = 85983233 (0x05200001)
        gst-launch-1.0 v4l2src device=/dev/video1 ! ...

Hi @gy4nt What do you see if you run with --verbose ? It should print the error message.

@janjongboom last 10 minutes have been here without getting more information!

root@8f2dea9fb62c:/usr/src/app# edge-impulse-linux --verbose
Edge Impulse Linux client v1.2.5

[SER] Using microphone hw:0,0

@gy4nt Can you do:

gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=10 ! video/x-raw,width=640,height=480 ! videoconvert ! jpegenc ! multifilesink location=test%05d.jpg

Hopefully that will shed some light here…

I’m wondering about mmal service 16.1 though, I don’t see that in your list of devices in your first post…

Let me attach all the logs below @janjongboom

root@8f2dea9fb62c:/usr/src/app# edge-impulse-linux
Edge Impulse Linux client v1.2.5

[SER] Using microphone hw:0,0
[SER] Using camera mmal service 16.1 starting...
Failed to initialize linux tool First photo was not created within 20 seconds
root@8f2dea9fb62c:/usr/src/app# gst-device-monitor-1.0
Probing devices...


Device found:

        name  : bcm2835-isp
        class : Video/Sink
        caps  : video/x-raw, format=(string)YUY2, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
                video/x-raw, format=(string)UYVY, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
                video/x-raw, format=(string)I420, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
                video/x-raw, format=(string)YV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
                video/x-raw, format=(string)BGRA, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], interlace-mode=(string)progressive, colorimetry=(string){ sRGB };
                video/x-raw, format=(string)BGR, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], interlace-mode=(string)progressive, colorimetry=(string){ sRGB };
                video/x-raw, format=(string)RGB, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], interlace-mode=(string)progressive, colorimetry=(string){ sRGB };
                video/x-raw, format=(string)NV21, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
                video/x-raw, format=(string)NV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
                video/x-raw, format=(string)RGB16, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], interlace-mode=(string)progressive, colorimetry=(string){ sRGB };
                video/x-bayer, format=(string)grbg, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], colorimetry=(string){ 1:1:0:0 };
                video/x-bayer, format=(string)gbrg, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], colorimetry=(string){ 1:1:0:0 };
                video/x-bayer, format=(string)rggb, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], colorimetry=(string){ 1:1:0:0 };
                video/x-bayer, format=(string)bggr, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], colorimetry=(string){ 1:1:0:0 };
                video/x-raw, format=(string)GRAY8, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ 2:0:0:0 };
                video/x-raw, format=(string)YVYU, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ bt601 };
                video/x-raw, format=(string)GRAY16_LE, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], interlace-mode=(string)progressive, colorimetry=(string){ 2:0:0:0 };
        properties:
                udev-probed = true
                device.bus_path = platform-bcm2835-isp
                sysfs.path = /sys/devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video13
                device.subsystem = video4linux
                device.product.name = bcm2835-isp
                device.capabilities = :video_output:
                device.api = v4l2
                device.path = /dev/video13
                v4l2.device.driver = bcm2835-isp
                v4l2.device.card = bcm2835-isp
                v4l2.device.bus_info = platform:bcm2835-isp
                v4l2.device.version = 328787 (0x00050453)
                v4l2.device.capabilities = 2216689666 (0x84200002)
                v4l2.device.device_caps = 69206018 (0x04200002)
        gst-launch-1.0 ... ! v4l2sink device=/dev/video13


Device found:

        name  : bcm2835-isp
        class : Video/Source
        caps  : video/x-raw, format=(string)YUY2, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)UYVY, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)I420, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)YV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)BGRA, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)BGR, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)RGB, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)NV21, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)NV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)RGB16, width=(int)[ 64, 16384 ], height=(int)[ 64, 16384 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)YVYU, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
        properties:
                udev-probed = true
                device.bus_path = platform-bcm2835-isp
                sysfs.path = /sys/devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video14
                device.subsystem = video4linux
                device.product.name = bcm2835-isp
                device.capabilities = :capture:
                device.api = v4l2
                device.path = /dev/video14
                v4l2.device.driver = bcm2835-isp
                v4l2.device.card = bcm2835-isp
                v4l2.device.bus_info = platform:bcm2835-isp
                v4l2.device.version = 328787 (0x00050453)
                v4l2.device.capabilities = 2216689665 (0x84200001)
                v4l2.device.device_caps = 69206017 (0x04200001)
        gst-launch-1.0 v4l2src device=/dev/video14 ! ...


Device found:

        name  : bcm2835-isp
        class : Video/Source
        caps  : video/x-raw, format=(string)YUY2, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)UYVY, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)I420, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)YV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)NV21, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)NV12, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
                video/x-raw, format=(string)YVYU, width=(int)[ 64, 16384, 2 ], height=(int)[ 64, 16384, 2 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
        properties:
                udev-probed = true
                device.bus_path = platform-bcm2835-isp
                sysfs.path = /sys/devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video15
                device.subsystem = video4linux
                device.product.name = bcm2835-isp
                device.capabilities = :capture:
                device.api = v4l2
                device.path = /dev/video15
                v4l2.device.driver = bcm2835-isp
                v4l2.device.card = bcm2835-isp
                v4l2.device.bus_info = platform:bcm2835-isp
                v4l2.device.version = 328787 (0x00050453)
                v4l2.device.capabilities = 2216689665 (0x84200001)
                v4l2.device.device_caps = 69206017 (0x04200001)
        gst-launch-1.0 v4l2src device=/dev/video15 ! ...


Device found:

        name  : mmal service 16.1
        class : Video/Source
        caps  : video/x-raw, format=(string)YUY2, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-raw, format=(string)UYVY, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-raw, format=(string)I420, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-raw, format=(string)YV12, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                image/jpeg, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                image/jpeg, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-raw, format=(string)BGR, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-raw, format=(string)RGB, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-raw, format=(string)NV21, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-raw, format=(string)NV12, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-raw, format=(string)YVYU, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
                video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, width=(int)[ 32, 2592, 2 ], height=(int)[ 32, 1944, 2 ], framerate=(fraction)[ 1/1, 90/1 ];
        properties:
                udev-probed = true
                device.bus_path = /sys/devices/virtual/video4linux/video0
                sysfs.path = /sys/devices/virtual/video4linux/video0
                device.subsystem = video4linux
                device.product.name = "mmal\ service\ 16.1"
                device.capabilities = :capture:video_overlay:
                device.api = v4l2
                device.path = /dev/video0
                v4l2.device.driver = "bm2835\ mmal"
                v4l2.device.card = "mmal\ service\ 16.1"
                v4l2.device.bus_info = platform:bcm2835-v4l2
                v4l2.device.version = 328787 (0x00050453)
                v4l2.device.capabilities = 2233466885 (0x85200005)
                v4l2.device.device_caps = 85983237 (0x05200005)
        gst-launch-1.0 v4l2src ! ...

root@8f2dea9fb62c:/usr/src/app# gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=10 ! video/x-raw,width=640,height=480 ! videoconvert ! jpegenc ! multifilesink location=test%05d.jpg
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

BTW Yesterday it worked well with an official Raspberry Pi Camera and a USB camera!

So this last command never exits? Does it write any files? Balena uses a container system right, I’d guess permissions somewhere for the camera…

Hi folks!
Does anybody has solved this problem?

Hi @AndriyHz,

This Balena app should work well with most webcams: https://github.com/just4give/balena-edge-impulse-linux

Aurelien

Exactly @janjongboom it never exits!

Balena uses a container system right, I’d guess permissions somewhere for the camera…

It’s odd, as this is a CSI pi camera check here

@AndriyHz what camera are you using?

1 Like

I too had this issue today with a Raspberry Pi 4B.

I was able to solve this by logging out of my Edge Impulse account and restarting my Pi.

Sometimes restarting does the trick.

Hopefully this is helpful to anyone who’s also running into this.

3 Likes

I have the same fault

Hello @kvamvake,

Which camera are you using?
Do you connect your camera using USB or the Camera Serial Interface (CSI)?

Also, what do you see when you run edge-impulse-linux --verbose?

Regards,

Louis