vc_mipi_nvidia icon indicating copy to clipboard operation
vc_mipi_nvidia copied to clipboard

Gstreamer and OV9281 error

Open hobbeshunter opened this issue 2 years ago • 5 comments

Hi,

I have two OV9281 EK0033311 V1.0 from you which I wanted to connect to my Jetson Nano B01 dev board. However when I try to use them with gstreamer it fails. I've tried L4T versions 32.6.1 and 32.7.2.

My device tree file is:
/*
 * Copyright (c) 2020-2021, Vision Components GmbH.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>

// ------------------------------------------------------------------------------------------------
//  Driver Configuration for NVIDIA Jetson Nano 4GB/2GB on NVIDIA Jetson Nano Developer Kit
// ------------------------------------------------------------------------------------------------
#define VC_MIPI_CAM_0       1   // 1: Enabled, 0: Disabled  (serial_a => CSI Port 0 => VI Stream 0)
#define VC_MIPI_CAM_1       1   // 1: Enabled, 0: Disabled  (serial_e => CSI Port 4 => VI Stream 4)
// ------------------------------------------------------------------------------------------------
//  Supported number of lanes
// -----+------------------------------------------------------------------------------------------
//  1   | OV7251, IMX296, IMX297
//  2   | OV9281, IMX264, IMX265
//  2,4 | IMX178, IMX183, IMX226, IMX250, IMX252, IMX273, IMX290, IMX327, IMX335, IMX392, 
//      | IMX412, IMX415, IMX568
// -----+------------------------------------------------------------------------------------------
#define VC_MIPI_LANES       2   // 1, 2 Lanes
// ------------------------------------------------------------------------------------------------
//   Sensor Manufacturer
// -----+------------------------------------------------------------------------------------------
//   1  | Sony Sensor (IMX)
//   2  | Omni Vision Sensor (OV)
// -----+------------------------------------------------------------------------------------------
#define VC_MIPI_MANUFACTURER 2
// ------------------------------------------------------------------------------------------------
//  GStreamer Support
// ------------------------------------------------------------------------------------------------
//  If you want to use GStreamer with nvarguscamerasrc you have to adjust this settings in the 
//  device tree below. The sections which have to be modified are marked by a comment. 
//  To find the correct parameter values please follow the instruction in the main README.md of 
//  this repository https://github.com/VC-MIPI-modules/vc_mipi_nvidia#gstreamer-support
// ------------------------------------------------------------------------------------------------

#define VC_MIPI_METADATA_H  "0"

#if VC_MIPI_LANES == 1
    #define BUS_WIDTH 1
    #define NUM_LANES "1" 
    #define NUM_CSI_LANES 2
#endif
#if VC_MIPI_LANES == 2
    #define BUS_WIDTH 2
    #define NUM_LANES "2" 
    #define NUM_CSI_LANES 4
#endif

#if VC_MIPI_CAM_0 == 1 && VC_MIPI_CAM_1 == 1
    #define VC_MIPI_CAMERAS 2
#else
    #define VC_MIPI_CAMERAS 1
#endif

/ {
    host1x {
        vc_vi_base: vi {
            num-channels = <VC_MIPI_CAMERAS>;
            ports {
                #address-cells = <1>;
                #size-cells = <0>;
#if VC_MIPI_CAM_0 == 1
                vc_vi_port0: port@0 {
                    reg = <0>;
                    vc_vi_in0: endpoint {
                        port-index = <0>;
                        bus-width = <BUS_WIDTH>;
                        remote-endpoint = <&vc_csi_out0>;
                    };
                };
#endif
#if VC_MIPI_CAM_1 == 1
                vc_vi_port1: port@1 {
                    reg = <1>;
                    vc_vi_in1: endpoint {
                        port-index = <4>;
                        bus-width = <BUS_WIDTH>;
                        remote-endpoint = <&vc_csi_out1>;
                    };
                };
#endif
            };
        };

        vc_csi_base: nvcsi {
            num-channels = <VC_MIPI_CAMERAS>;
            #address-cells = <1>;
            #size-cells = <0>;
#if VC_MIPI_CAM_0 == 1
            vc_csi_chan0: channel@0 {
                reg = <0>;
                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    vc_csi_chan0_port0: port@0 {
                        reg = <0>;
                        vc_csi_in0: endpoint@0 {
                            port-index = <0>;
                            bus-width = <BUS_WIDTH>;
                            remote-endpoint = <&vc_mipi_out0>;
                        };
                    };
                    vc_csi_chan0_port1: port@1 {
                        reg = <1>;
                        vc_csi_out0: endpoint@1 {
                            remote-endpoint = <&vc_vi_in0>;
                        };
                    };
                };
            };
#endif
#if VC_MIPI_CAM_1 == 1
            vc_csi_chan1: channel@1 {
                reg = <1>;
                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    vc_csi_chan1_port0: port@0 {
                        reg = <0>;
                        vc_csi_in1: endpoint@2 {
                            port-index = <4>;
                            bus-width = <BUS_WIDTH>;
                            remote-endpoint = <&vc_mipi_out1>;
                        };
                    };
                    vc_csi_chan1_port1: port@1 {
                        reg = <1>;
                        vc_csi_out1: endpoint@3 {
                            remote-endpoint = <&vc_vi_in1>;
                        };
                    };
                };
            };
#endif
        };
    };

    cam_i2cmux {
#if VC_MIPI_CAM_0 == 1
        i2c@0 {
#if VC_MIPI_MANUFACTURER == 1
            vc_mipi_cam0: vc_mipi@1a {
                reg                     = <0x1a>;
#else
            vc_mipi_cam0: vc_mipi@60 {
                reg                     = <0x60>;
#endif
                compatible              = "nvidia,vc_mipi";
                devnode                 = "video0";
                use_sensor_mode_id      = "false";
                sensor_model            = "vc_mipi";

                num_lanes               = NUM_LANES;
                trigger_mode            = "0";
                io_mode                 = "0";

                // ----------------------------------------------------
                // If you want to use GStreamer with nvarguscamerasrc
                // you have to adjust this settings
                physical_w              = "3.840";
                physical_h              = "2.400";
                // ----------------------------------------------------

                // This node is needed by the Tegra framework.
                // You don't have to change any settings if just want to use the V4L API.
                mode0 {
                    num_lanes                = NUM_LANES;
                    tegra_sinterface         = "serial_a";
                    embedded_metadata_height = VC_MIPI_METADATA_H;
                    readout_orientation      = "0";

                    // ----------------------------------------------------
                    // If you want to use GStreamer with nvarguscamerasrc
                    // you have to adjust this settings. 
                    active_l                 = "0";
                    active_t                 = "0";
                    active_w                 = "1280";
                    active_h                 = "800";
                    pixel_t                  = "bayer_rggb";

                    min_gain_val             = "0";         // mdB
                    max_gain_val             = "12000";     // mdB
                    step_gain_val            = "50";       // mdB
                    default_gain             = "0";         // mdB

                    min_exp_time             = "1";         // us
                    max_exp_time             = "1000000";   // us
                    step_exp_time            = "1";         // us
                    default_exp_time         = "10000";     // us

                    min_framerate            = "0";         // mHz
                    max_framerate            = "120600";     // mHz
                    step_framerate           = "100";       // mHz
                    default_framerate        = "120600";     // mHz
                    // ----------------------------------------------------

                    gain_factor              = "1000";
                    exposure_factor          = "1000000";
                    framerate_factor         = "1000";
                    inherent_gain            = "1";
                    min_hdr_ratio            = "1";
                    max_hdr_ratio            = "1";

                    line_length              = "0";
                    phy_mode                 = "DPHY";
                    discontinuous_clk        = "no";
                    mclk_khz                 = "24000";
                    pix_clk_hz               = "800000000";
                    mclk_multiplier          = "9.33";
                    cil_settletime           = "0";
                    dpcm_enable              = "false";
                };

                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    port@0 {
                        reg = <0>;
                        vc_mipi_out0: endpoint {
                            port-index = <0>;
                            bus-width = <BUS_WIDTH>;
                            remote-endpoint = <&vc_csi_in0>;
                        };
                    };
                };
            };
        };
#endif
#if VC_MIPI_CAM_1 == 1
        i2c@1 {
#if VC_MIPI_MANUFACTURER == 1
            vc_mipi_cam1: vc_mipi@1a {
                reg                     = <0x1a>;
#else
            vc_mipi_cam1: vc_mipi@60 {
                reg                     = <0x60>;
#endif
                compatible              = "nvidia,vc_mipi";
                devnode                 = "video1";
                use_sensor_mode_id      = "false";
                sensor_model            = "vc_mipi";

                num_lanes               = NUM_LANES;
                trigger_mode            = "0";
                io_mode                 = "0";

                // ----------------------------------------------------
                // If you want to use GStreamer with nvarguscamerasrc
                // you have to adjust this settings
                physical_w              = "3.840";
                physical_h              = "2.400";
                // ----------------------------------------------------

                // This node is needed by the Tegra framework.
                // You don't have to change any settings if just want to use the V4L API.
                mode0 {
                    num_lanes                = NUM_LANES;
                    tegra_sinterface         = "serial_e";
                    embedded_metadata_height = VC_MIPI_METADATA_H;
                    readout_orientation      = "0";

                    // ----------------------------------------------------
                    // If you want to use GStreamer with nvarguscamerasrc
                    // you have to adjust this settings. 
                    active_l                 = "0";
                    active_t                 = "0";
                    active_w                 = "1280";
                    active_h                 = "800";
                    pixel_t                  = "bayer_rggb";

                    min_gain_val             = "0";         // mdB
                    max_gain_val             = "12000";     // mdB
                    step_gain_val            = "50";       // mdB
                    default_gain             = "0";         // mdB

                    min_exp_time             = "1";         // us
                    max_exp_time             = "1000000";   // us
                    step_exp_time            = "1";         // us
                    default_exp_time         = "10000";     // us

                    min_framerate            = "0";         // mHz
                    max_framerate            = "120600";     // mHz
                    step_framerate           = "100";       // mHz
                    default_framerate        = "120600";     // mHz
                    // ----------------------------------------------------

                    gain_factor              = "1000";
                    exposure_factor          = "1000000";
                    framerate_factor         = "1000";
                    inherent_gain            = "1";
                    min_hdr_ratio            = "1";
                    max_hdr_ratio            = "1";

                    line_length              = "0";
                    phy_mode                 = "DPHY";
                    discontinuous_clk        = "no";
                    mclk_khz                 = "24000";
                    pix_clk_hz               = "800000000";
                    mclk_multiplier          = "9.33";
                    cil_settletime           = "0";
                    dpcm_enable              = "false";
                };

                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    port@0 {
                        reg = <0>;
                        vc_mipi_out1: endpoint {
                            port-index = <4>;
                            bus-width = <BUS_WIDTH>;
                            remote-endpoint = <&vc_csi_in1>;
                        };
                    };
                };
            };
        };
#endif
    };

    lens@vc_mipi {
        min_focus_distance  = "0.0";
        hyper_focal         = "0.0";
        focal_length        = "6.0";
        f_number            = "2.0";
        aperture            = "0.0";
    };
};

/ {
    tcp: tegra-camera-platform {
        compatible = "nvidia, tegra-camera-platform";

        num_csi_lanes = <NUM_CSI_LANES>;
        max_lane_speed = <1500000>;
        min_bits_per_pixel = <10>;
        vi_peak_byte_per_pixel = <2>;
        vi_bw_margin_pct = <25>;
        max_pixel_rate = <240000>;
        isp_peak_byte_per_pixel = <5>;
        isp_bw_margin_pct = <25>;

        modules {
#if VC_MIPI_CAM_0 == 1
            cam_module0: module0 {
                status = "okay";
                badge = "porg_front_vc_mipi";
                position = "front";
                orientation = "1";
                cam_module0_drivernode0: drivernode0 {
                    status = "okay";
                    pcl_id = "v4l2_sensor";
#if VC_MIPI_MANUFACTURER == 1
                    devname = "vc_mipi 7-001a";
                    proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/vc_mipi@1a";
#else
                    devname = "vc_mipi 7-0060";
                    proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/vc_mipi@60";
#endif
                };
                cam_module0_drivernode1: drivernode1 {
                    status = "okay";
                    pcl_id = "v4l2_lens";
                    proc-device-tree = "/proc/device-tree/lens@vc_mipi/";
                };
            };
#endif
#if VC_MIPI_CAM_1 == 1
            cam_module1: module1 {
                status = "okay";
                badge = "porg_rear_vc_mipi";
                position = "rear";
                orientation = "1";
                cam_module1_drivernode0: drivernode0 {
                    status = "okay";
                    pcl_id = "v4l2_sensor";
#if VC_MIPI_MANUFACTURER == 1
                    devname = "vc_mipi 8-001a";
                    proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/vc_mipi@1a";
#else
                    devname = "vc_mipi 8-0060";
                    proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/vc_mipi@60";
#endif
                };
                cam_module1_drivernode1: drivernode1 {
                    status = "okay";
                    pcl_id = "v4l2_lens";
                    proc-device-tree = "/proc/device-tree/lens@vc_mipi/";
                };
            };
#endif
        };
    };
};

#define CAM1_PWDN     TEGRA_GPIO(S, 7)
#define CAM2_PWDN     TEGRA_GPIO(T, 0)
#define CAM_I2C_MUX   TEGRA_GPIO(I, 0)

/ {
    cam_i2cmux {
        status = "okay";
        compatible = "i2c-mux-gpio";
        #address-cells = <1>;
        #size-cells = <0>;
        mux-gpios = <&gpio CAM_I2C_MUX GPIO_ACTIVE_HIGH>;
        i2c-parent = <&i2c7>;
#if VC_MIPI_CAM_0 == 1
        i2c@0 {
            status = "okay";
            reg = <0>;
            #address-cells = <1>;
            #size-cells = <0>;
#if VC_MIPI_MANUFACTURER == 1
            vc_mipi@1a {
#else
            vc_mipi@60 {
#endif
                status = "okay";
                reset-gpios = <&gpio CAM1_PWDN GPIO_ACTIVE_HIGH>;
            };
        };
#endif
#if VC_MIPI_CAM_1 == 1
        i2c@1 {
            status = "okay";
            reg = <1>;
            #address-cells = <1>;
            #size-cells = <0>;
#if VC_MIPI_MANUFACTURER == 1
            vc_mipi@1a {
#else
            vc_mipi@60 {
#endif
                status = "okay";
                reset-gpios = <&gpio CAM2_PWDN GPIO_ACTIVE_HIGH>;
            };
        };
#endif
    };

    gpio@6000d000 {
        camera-control-output-low {
            gpio-hog;
            output-low;
            gpios = <CAM1_PWDN 0 CAM2_PWDN 0>;
            label = "cam1-pwdn", "cam2-pwdn";
        };
    };
};

After setting

v4l2-ctl --set-fmt-video=pixelformat=RG10,width=1280,height=800

guvcview gives:

Show log
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev0
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev1
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev2
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev3
Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120.599999; Analog Gain Range Min 0.000000, Max 12.000000, Exposure Range Min 1000, Max 1000000000

V4L2_CORE: Unable to find parent usb device.Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120.599999; Analog Gain Range Min 0.000000, Max 12.000000, Exposure Range Min 1000, Max 1000000000

V4L2_CORE: Unable to find parent usb device.GUVCVIEW: version 2.0.5
GUVCVIEW: couldn't open /home/<user>/.config/guvcview2/video0 for read: No such file or directory
Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120,599999; Analog Gain Range Min 0,000000, Max 12,000000, Exposure Range Min 1000, Max 1000000000

DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
V4L2_CORE: Error opening device /dev/video0: video capture not supported.
GUVCVIEW (1): Guvcview error
	 no video device found

(guvcview:22823): Gtk-WARNING **: 21:17:12.386: Theme parsing error: <data>:1:17: not a number

(guvcview:22823): Gtk-WARNING **: 21:17:12.387: Theme parsing error: <data>:1:31: Using Pango syntax for the font: style property is deprecated; please use CSS syntax

(guvcview:22823): Gtk-WARNING **: 21:17:12.387: Theme parsing error: <data>:1:17: not a number

(guvcview:22823): Gtk-WARNING **: 21:17:12.387: Theme parsing error: <data>:1:32: Using Pango syntax for the font: style property is deprecated; please use CSS syntax

(guvcview:22823): Gtk-WARNING **: 21:17:12.387: Theme parsing error: <data>:1:17: not a number

(guvcview:22823): Gtk-WARNING **: 21:17:12.387: Theme parsing error: <data>:1:26: Using Pango syntax for the font: style property is deprecated; please use CSS syntax
Gtk-Message: 21:17:12.479: GtkDialog mapped without a transient parent. This is discouraged.
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev0
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev1
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev2
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev3
Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120.599999; Analog Gain Range Min 0.000000, Max 12.000000, Exposure Range Min 1000, Max 1000000000

V4L2_CORE: Unable to find parent usb device.Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120.599999; Analog Gain Range Min 0.000000, Max 12.000000, Exposure Range Min 1000, Max 1000000000

V4L2_CORE: Unable to find parent usb device.GUVCVIEW: version 2.0.5
GUVCVIEW: couldn't open /home/<user>/.config/guvcview2/video1 for read: No such file or directory
Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120,599999; Analog Gain Range Min 0,000000, Max 12,000000, Exposure Range Min 1000, Max 1000000000

DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
V4L2_CORE: Error opening device /dev/video1: video capture not supported.
GUVCVIEW (1): Guvcview error
	 no video device found

(guvcview:23012): Gtk-WARNING **: 21:17:18.014: Theme parsing error: <data>:1:17: not a number

(guvcview:23012): Gtk-WARNING **: 21:17:18.014: Theme parsing error: <data>:1:31: Using Pango syntax for the font: style property is deprecated; please use CSS syntax

(guvcview:23012): Gtk-WARNING **: 21:17:18.014: Theme parsing error: <data>:1:17: not a number

(guvcview:23012): Gtk-WARNING **: 21:17:18.015: Theme parsing error: <data>:1:32: Using Pango syntax for the font: style property is deprecated; please use CSS syntax

(guvcview:23012): Gtk-WARNING **: 21:17:18.015: Theme parsing error: <data>:1:17: not a number

(guvcview:23012): Gtk-WARNING **: 21:17:18.015: Theme parsing error: <data>:1:26: Using Pango syntax for the font: style property is deprecated; please use CSS syntax
Gtk-Message: 21:17:18.061: GtkDialog mapped without a transient parent. This is discouraged.
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev0
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev1
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev2
Opening in O_NONBLOCKING MODE 
libv4l2: error getting capabilities: Inappropriate ioctl for device
V4L2_CORE: ERROR opening V4L2 interface for /dev/v4l-subdev3
Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120.599999; Analog Gain Range Min 0.000000, Max 12.000000, Exposure Range Min 1000, Max 1000000000

V4L2_CORE: Unable to find parent usb device.Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120.599999; Analog Gain Range Min 0.000000, Max 12.000000, Exposure Range Min 1000, Max 1000000000

V4L2_CORE: Unable to find parent usb device.GUVCVIEW: version 2.0.5
GUVCVIEW: couldn't open /home/<user>/.config/guvcview2/video0 for read: No such file or directory
Opening in BLOCKING MODE
Available Sensor modes :
Resolution: 1280 x 800 ; Framerate = 120,599999; Analog Gain Range Min 0,000000, Max 12,000000, Exposure Range Min 1000, Max 1000000000

DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
DEFAULT no IOCTL called
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Invalid argument
V4L2_CORE: Error opening device /dev/video0: video capture not supported.
GUVCVIEW (1): Guvcview error
	 no video device found

Running nvgstcapture-1.0 gives:

Show log
$ nvgstcapture-1.0 --camsrc=0 --cap-dev-node=0
Encoder null, cannot set bitrate!
Encoder Profile = High
Runtime USB Camera Commands:

  Help : 'h'
  Quit : 'q'
  Set Capture Mode:
      mo:<val>
          (1): image
          (2): video
  Get Capture Mode:
      gmo
  Capture: enter 'j' OR
           followed by a timer (e.g., jx5000, capture after 5 seconds) OR
           followed by multishot count (e.g., j:6, capture 6 images)
           timer/multihot values are optional, capture defaults to single shot with timer=0s
  Start Recording : enter '1'
  Stop Recording  : enter '0'
  Set Preview Resolution:
      pcr:<val> e.g., pcr:2
          (0) : 176x144
          (1) : 320x240
          (2) : 640x480
          (3) : 1280x720
          (4) : 1920x1080
  NOTE: Preview/Encode resolution will be same as Capture resolution for USB-Camera
  Get Preview Resolution:
      gpcr
  Get Image Capture Resolution:
      gicr
  Get Video Capture Resolution:
      gvcr
  Set Capture Device Node:
      cdn:<val> e.g., cdn:0
          (0): /dev/video0
          (1): /dev/video1
          (2): /dev/video2
  Get Capture Device Node:
      gcdn


Runtime encoder configuration options:

  Set Encoding Bit-rate(in bytes):
      br:<val> e.g., br:4000000
  Get Encoding Bit-rate(in bytes):
      gbr
  Set Encoding Profile(only for H.264):
      ep:<val> e.g., ep:1
          (0): Baseline
          (1): Main
          (2): High
  Get Encoding Profile(only for H.264):
      gep
  Force IDR Frame on video Encoder(only for H.264):
      Enter 'f' 


** Message: 21:27:49.643: <main:4670> iterating capture loop ....
ERROR on bus: by /GstPipeline:capture_native_pipeline/GstBin:cap_bin/GstV4l2Src:v4l2src0: Internal data stream error.
debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:capture_native_pipeline/GstBin:cap_bin/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
** Message: 21:27:49.703: <main:4680> Capture completed
** Message: 21:27:49.703: <main:4729> Camera application will now exit

Have I forgotten some setting?

hobbeshunter avatar Jul 02 '23 19:07 hobbeshunter

Hi hobbeshunter, guvcview and nvgstcapture-1.0 are not tested and therefore not supported. Please use gst-launch-1.0 to use gstreamer:

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),framerate=20/1' ! autovideosink

I can't see any errors in your device tree file.

pmliquify avatar Jul 11 '23 16:07 pmliquify

Thank you very much. That worked!

Follow up newby question: How do I use this with opencv?

I've tried

import cv2
import sys

gst_str = "nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),framerate=20/1' ! appsink"

cap = cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
if not cap.isOpened():
    print('Failed to open camera!')
    sys.exit()
while(True):
    _, img = cap.read()
    cv2.imshow("cam", img)
    key = cv2.waitKey(10)

without luck. OpenCV version is 3.2.0.

Thanks in advance!

hobbeshunter avatar Jul 22 '23 11:07 hobbeshunter

Any tipp on how to do it?

hobbeshunter avatar Jul 31 '23 15:07 hobbeshunter

Hi @hobbeshunter I am very busy currently. I try to support you from the 14th.

pmliquify avatar Aug 03 '23 07:08 pmliquify

Some more results from experiments:

When I try

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),framerate=20/1,format=NV12,width=1280,height=800' ! nvvidconv ! 'video/x-raw, format=GRAY8' ! autovideosink

I get following error:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1280 x 800 FR = 120,599999 fps Duration = 8291874 ; Analog Gain range min 0,000000, max 12,000000; Exposure Range min 1000, max 1000000000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 0 
   Output Stream W = 1280 H = 800 
   seconds to Run    = 0 
   Frame Rate = 120,599999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
ERROR: from element /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.507162580
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...

hobbeshunter avatar Aug 21 '23 18:08 hobbeshunter