Unable to capture video in 4K resolution


  • IMX477 motorized AF camera
  • MIPI interface
  • Raspberry Pi 4
  • arducam library : < [update libarducam_mipicamera.so add imx477 Resolution]

I am programming with reference to documentation and examples.
But strangely, it captures well in 1920x1080 resolution, but in 4K resolution, the stripe screen is captured as shown in the figure below.
So, when I tried using arducamstill in the library, the phenomenon that capture was not possible in 4K appeared as shown below.
Please let me know what is wrong with this.



Please update about this issue.

Hello, I tested it myself and found no problems. The picture below is the result of my own test. You can try to run the ./arducamstill -t 0 command, and then observe whether the output image is always problematic? Can you send me a screenshot of the running result?

you are right.
I use the arducam still command to get a good picture.
The attached image below is a photo I took.

In the end I guess the problem is that the C program I wrote is wrong.
I programmed it referring to the APIs in capture2opencv of arducam library.
I’m guessing maybe it’s not weird in the get_image part, which converts the image contents of the buffer into an opencv Matrix.

Please refer to the attachment below and help.

cv::Mat *get_image(CAMERA_INSTANCE camera_instance, int width, int height) {
    IMAGE_FORMAT yuv = {IMAGE_ENCODING_I420, 50}; //streaming ok, capture fail
    BUFFER *buffer = arducam_capture(camera_instance, &yuv, 3000);
    if (!buffer) {
        return NULL;
    // The actual width and height of the IMAGE_ENCODING_RAW_BAYER format and the IMAGE_ENCODING_I420 format are aligned, 
    // width 32 bytes aligned, and height 16 byte aligned.
    width = VCOS_ALIGN_UP(width, 32);
    height = VCOS_ALIGN_UP(height, 16);
    cv::Mat *image = new cv::Mat(cv::Size(width,(int)(height * 1.5)), CV_8UC1, buffer->data);
    cv::cvtColor(*image, *image, cv::COLOR_YUV2BGR_I420);
    return image;

static void t_camera_streaming(CAMERA_MODE mode) {
    int res;
    int counter=0;
    Camera.instance = NULL;
    res = arducam_init_camera(&Camera.instance);
    if (res) {
        ERR("init camera status = %d", res);
        return ;
    arducam_set_mode(Camera.instance, 2);
    //arducam_set_resolution(Camera.instance, &Camera.stream_width, &Camera.stream_height);

    DBG("Enable Software Auto Exposure...");
    arducam_software_auto_exposure(Camera.instance, 1);
#if defined(SOFTWARE_AE_AWB) //doesn't support, check list_format' index
    DBG("Enable Software Auto White Balance...");
    arducam_software_auto_white_balance(Camera.instance, 1);
    DBG("Waiting for automatic adjustment to complete...");
    sleep_seconds(3); //need to prevent green image at streaming mode
    cv::Mat resize_mjpg;
    cv::Mat resize_af;
    cv::Point pt(200, 200);
    cv::Mat *image;
        image = NULL;
        image = get_image(Camera.instance, Camera.stream_width, Camera.stream_height);        
        if(!image) {
            DBG("image is null.............................");
        CameraReceiving = true;