avafinger / bananapi-zero-ubuntu-base-minimal

BananaPi M2 Zero - Ubuntu Focal Base Minimal Image (Experimental) - U-Boot 2017.09 / Kernel 4.18.y / Kernel 4.19.y / Kernel 4.20.y / Kernel 5.3.y / Kernel 5.6.y / Kernel 5.7.y / Kernel 5.11.y
88 stars 17 forks source link

Problem with OV5640 DVP camera #56

Closed thiagobucca closed 3 years ago

thiagobucca commented 3 years ago

Hi, i'm having some issues on getting my OV5640 DVP camera to work with this image and kernel 5.6, whenever i start mjpeg-streamer, i get this:

MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34 i: Using V4L2 device.: /dev/video1 i: Desired Resolution: 1280 x 720 i: Frames Per Second.: -1 i: Format............: JPEG i: TV-Norm...........: DEFAULT i: Could not obtain the requested pixelformat: MJPG , driver gave us: BA81 ... will try to handle this by checking against supported formats. Init v4L2 failed !! exit fatal i: init_VideoIn failed

My topology is:

`Media controller API version 5.7.7

Media device information

driver sun6i-csi model Allwinner Video Capture Device serial
bus info
hw revision 0x0 driver version 5.7.7

Device topology

did u used a different mjpeg-streamer version or any custom config to make this work like you show in this repo readme?

thanks in advance

avafinger commented 3 years ago

Can you give the complete output? Looks like it is asking for MJPEG and the sensor is only JPEG.

You should have in your code:

        case V4L2_PIX_FMT_MJPEG:
            // Fall-through intentional
        case V4L2_PIX_FMT_JPEG:
            fmtString = "JPEG";
            break;
thiagobucca commented 3 years ago

Yes i checked it and i have this line under input_uvc.c.

Here's the complete output of what i've tried so far:

pi@bpizero:~/mjpg-streamer/mjpg-streamer-experimental$ ll /dev/video*
crw-rw---- 1 root video 81, 0 Apr  1  2020 /dev/video0
crw-rw---- 1 root video 81, 1 Apr  1  2020 /dev/video1
pi@bpizero:~/mjpg-streamer/mjpg-streamer-experimental$ ll /dev/media*
crw-rw-rw- 1 root video 243, 0 Apr  1  2020 /dev/media0
crw-rw-rw- 1 root video 243, 1 Apr  1  2020 /dev/media1
pi@bpizero:~/mjpg-streamer/mjpg-streamer-experimental$ media-ctl --device /dev/media1 --print-topology
Media controller API version 5.7.6

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial          
bus info        
hw revision     0x0
driver version  5.7.6

Device topology
- entity 1: sun6i-csi (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
    pad0: Sink
        <- "ov5640 3-003c":0 [ENABLED,IMMUTABLE]

- entity 5: ov5640 3-003c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev0
    pad0: Source
        -> "sun6i-csi":0 [ENABLED,IMMUTABLE]
pi@bpizero:~/mjpg-streamer/mjpg-streamer-experimental$ media-ctl -v --device /dev/media1 --known-mbus-fmts
RGB444_1X12                     0x1016
RGB444_2X8_PADHI_BE             0x1001
RGB444_2X8_PADHI_LE             0x1002
RGB555_2X8_PADHI_BE             0x1003
RGB555_2X8_PADHI_LE             0x1004
RGB565_1X16                     0x1017
BGR565_2X8_BE                   0x1005
BGR565_2X8_LE                   0x1006
RGB565_2X8_BE                   0x1007
RGB565_2X8_LE                   0x1008
RGB666_1X18                     0x1009
RBG888_1X24                     0x100e
RGB666_1X24_CPADHI              0x1015
RGB666_1X7X3_SPWG               0x1010
BGR888_1X24                     0x1013
BGR888_3X8                      0x101b
GBR888_1X24                     0x1014
RGB888_1X24                     0x100a
RGB888_2X12_BE                  0x100b
RGB888_2X12_LE                  0x100c
RGB888_1X7X4_SPWG               0x1011
RGB888_1X7X4_JEIDA              0x1012
ARGB8888_1X32                   0x100d
RGB888_1X32_PADHI               0x100f
RGB101010_1X30                  0x1018
RGB121212_1X36                  0x1019
RGB161616_1X48                  0x101a
Y8_1X8                          0x2001
UV8_1X8                         0x2015
UYVY8_1_5X8                     0x2002
VYUY8_1_5X8                     0x2003
YUYV8_1_5X8                     0x2004
YVYU8_1_5X8                     0x2005
UYVY8_2X8                       0x2006
VYUY8_2X8                       0x2007
YUYV8_2X8                       0x2008
YVYU8_2X8                       0x2009
Y10_1X10                        0x200a
Y10_2X8_PADHI_LE                0x202c
UYVY10_2X10                     0x2018
VYUY10_2X10                     0x2019
YUYV10_2X10                     0x200b
YVYU10_2X10                     0x200c
Y12_1X12                        0x2013
UYVY12_2X12                     0x201c
VYUY12_2X12                     0x201d
YUYV12_2X12                     0x201e
YVYU12_2X12                     0x201f
UYVY8_1X16                      0x200f
VYUY8_1X16                      0x2010
YUYV8_1X16                      0x2011
YVYU8_1X16                      0x2012
YDYUYDYV8_1X16                  0x2014
UYVY10_1X20                     0x201a
VYUY10_1X20                     0x201b
YUYV10_1X20                     0x200d
YVYU10_1X20                     0x200e
VUY8_1X24                       0x2024
YUV8_1X24                       0x2025
UYYVYY8_0_5X24                  0x2026
UYVY12_1X24                     0x2020
VYUY12_1X24                     0x2021
YUYV12_1X24                     0x2022
YVYU12_1X24                     0x2023
YUV10_1X30                      0x2016
UYYVYY10_0_5X30                 0x2027
AYUV8_1X32                      0x2017
UYYVYY12_0_5X36                 0x2028
YUV12_1X36                      0x2029
YUV16_1X48                      0x202a
UYYVYY16_0_5X48                 0x202b
SBGGR8_1X8                      0x3001
SGBRG8_1X8                      0x3013
SGRBG8_1X8                      0x3002
SRGGB8_1X8                      0x3014
SBGGR10_ALAW8_1X8               0x3015
SGBRG10_ALAW8_1X8               0x3016
SGRBG10_ALAW8_1X8               0x3017
SRGGB10_ALAW8_1X8               0x3018
SBGGR10_DPCM8_1X8               0x300b
SGBRG10_DPCM8_1X8               0x300c
SGRBG10_DPCM8_1X8               0x3009
SRGGB10_DPCM8_1X8               0x300d
SBGGR10_2X8_PADHI_BE            0x3003
SBGGR10_2X8_PADHI_LE            0x3004
SBGGR10_2X8_PADLO_BE            0x3005
SBGGR10_2X8_PADLO_LE            0x3006
SBGGR10_1X10                    0x3007
SGBRG10_1X10                    0x300e
SGRBG10_1X10                    0x300a
SRGGB10_1X10                    0x300f
SBGGR12_1X12                    0x3008
SGBRG12_1X12                    0x3010
SGRBG12_1X12                    0x3011
SRGGB12_1X12                    0x3012
SBGGR14_1X14                    0x3019
SGBRG14_1X14                    0x301a
SGRBG14_1X14                    0x301b
SRGGB14_1X14                    0x301c
SBGGR16_1X16                    0x301d
SGBRG16_1X16                    0x301e
SGRBG16_1X16                    0x301f
SRGGB16_1X16                    0x3020
JPEG_1X8                        0x4001
S5C_UYVY_JPEG_1X8               0x5001
AHSV8888_1X32                   0x6001

and then:

pi@bpizero:~/mjpg-streamer/mjpg-streamer-experimental$ sudo   media-ctl --device /dev/media1 --set-v4l2 '"ov5640 3-003c":0[fmt:JPEG_1X8/1280x720]'
pi@bpizero:~/m

and finally:

pi@bpizero:~/mjpg-streamer/mjpg-streamer-experimental$ sudo ./mjpg_streamer -i "./input_uvc.so -d /dev/video1 -r 1280x720 -q 90 -n" -o "./output_http.so -p 8080 -w ./www"
MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34
 i: Using V4L2 device.: /dev/video1
 i: Desired Resolution: 1280 x 720
 i: Frames Per Second.: -1
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
 i: Could not obtain the requested pixelformat: MJPG , driver gave us: BA81
    ... will try to handle this by checking against supported formats. 
Init v4L2 failed !! exit fatal
 i: init_VideoIn failed

Kernel info:

pi@bpizero:~/mjpg-streamer/mjpg-streamer-experimental$ uname -a
Linux bpizero 5.7.6 #1 SMP Sun Jun 28 00:11:55 -03 2020 armv7l armv7l armv7l GNU/Linux

And i'm using this camera: https://pt.aliexpress.com/item/33040577292.html?spm=a2g0s.9042311.0.0.2742b90aU6SuU3

And i got mjpg-streamer version from this repo: https://github.com/jacksonliam/mjpg-streamer

is there anything else that i should look?

avafinger commented 3 years ago

The sensor is fine.

Try changing line: https://github.com/jacksonliam/mjpg-streamer/blob/master/mjpg-streamer-experimental/plugins/input_uvc/input_uvc.c#L141

to

int width = 640, height = 480, fps = -1, format = V4L2_PIX_FMT_JPEG, i;

thiagobucca commented 3 years ago

nice, now is working flawlessly

thank you!