Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:edge-2l:add-ons:edge-2l-mipi-camera

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
products:sbc:edge-2l:add-ons:edge-2l-mipi-camera [2025/11/26 03:41]
gray created
products:sbc:edge-2l:add-ons:edge-2l-mipi-camera [2026/05/11 02:05] (current)
nick ↷ Page moved from local:users:gray:products:sbc:edge-2l:add-ons:edge-2l-mipi-camera to products:sbc:edge-2l:add-ons:edge-2l-mipi-camera
Line 2: Line 2:
  
  
-====== Edge-2L MIPI Camera Usage ======+====== Edge-2L MIPI camera usage ======
  
  
 ===== Linux ===== ===== Linux =====
  
 +All camera interfaces on the Edge-2L support 4K@60fps recording.
  
-<WRAP important > +==== Video node ====
- +
-Edge-2L CAM3 support **4K@60fps** record. If your **hardware version is V13 or later**, the **CAM2** also can support **4K@60fps** record.  +
- +
-**Check Hardware Version** +
-```shell +
-$ cat /proc/cmdline +
-``` +
-V13 or later version will show like ''hwver=EDGE2.V13''+
- +
-Due to the different hardware versions, **CAM2 is set to 4K@30fps by default**. This is for compatibility with V11 or V12 hardware versions to  +
-ensure proper operation. If your device supports 4K@60fps, you can enable this mode by adding an overlay node ''cam2-4lane''+
- +
- +
-Edit ''/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env'' to setup ''fdt_overlays=cam2-4lane''+
- +
-<tabbox Fenix 1.7.4 or older version> +
- +
-About IMX585 and IMX678, the two cameras were disabled by default. So V11 or V12 hardware version should replace ''cam2-4lane'' by ''imx585'' or ''imx678'': +
- +
-Edit ''/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env'' to setup ''fdt_overlays=imx585'' or ''fdt_overlays=imx678''+
- +
- +
-V13 or later hardware version should be set ''imx585-cam2-4lane'' or ''imx678-cam2-4lane'': +
- +
-Edit ''/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env'' to setup ''fdt_overlays=imx585-cam2-4lane'' or ''fdt_overlays=imx678-cam2-4lane''+
- +
-<tabbox Fenix 1.7.5 or later version> +
- +
-We enbale imx585 and imx678 by default, so just add overlay node ''cam2-4lane'' can let CAM2 interface support 4K@60fsp. +
- +
-</tabbox> +
- +
-You need to reboot the device to take effect. +
- +
-</WRAP> +
- +
-==== Upgrade System ==== +
- +
-Please follow the [[products:sbc:edge-2l:configurations:upgrade-system|documentation ]]to upgrade your system to latest version. +
- +
-==== Video Node ====+
  
  
Line 55: Line 15:
  
 |        ^  Video Node    ^ |        ^  Video Node    ^
-^  CAM1  |  /dev/video42  | +^  CAM1  |  /dev/video22  | 
-^  CAM2  |  /dev/video33 +^  CAM2  |  /dev/video31  |
-^  CAM3  |  /dev/video51  |+
  
-==== Record Video with Gstreamer ====+==== Record video with gstreamer ====
  
- 
-Record video from ''CAM1'': 
- 
-```shell 
-gst-launch-1.0 v4l2src device=/dev/video42 io-mode=dmabuf min-buffers=64 num-buffers=300 ! video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video42.mp4 
-``` 
  
 Record video from ''CAM2'': Record video from ''CAM2'':
  
 ```shell ```shell
-gst-launch-1.0 v4l2src device=/dev/video33 io-mode=dmabuf min-buffers=64 num-buffers=300 ! video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video33.mp4+gst-launch-1.0 v4l2src device=/dev/video31 io-mode=dmabuf min-buffers=64 num-buffers=300 ! video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video31.mp4
 ``` ```
-For 4K@60fps, framerate should be set 60/1 
  
-Record video from ''CAM3'':+Record video from ''CAM1'':
  
 ```shell ```shell
-gst-launch-1.0 v4l2src device=/dev/video51 io-mode=dmabuf min-buffers=64 num-buffers=600 ! video/x-raw,format=NV12,width=3840,height=2160,framerate=60/1 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video51.mp4+gst-launch-1.0 v4l2src device=/dev/video22 io-mode=dmabuf min-buffers=64 num-buffers=300 ! video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video22.mp4
 ``` ```
  
-/* +==== Capture frame with V4L2 utils ====
-==== Record Video with OpenCV ==== +
- +
-Follow the steps bellow to install OpenCV: +
- +
-```shell +
-sudo apt update +
-sudo apt install libopencv-dev python3-opencv +
-``` +
- +
-''C++'' source code: +
- +
-```c++ mipi-camera.cpp +
-#include <opencv2/highgui/highgui.hpp> +
-#include <opencv2/imgproc/imgproc.hpp> +
-#include <opencv2/core/core.hpp> +
-#include <iostream> +
-#include <string> +
-using +
-namespace  cv; +
- +
-using +
-namespace  std; +
- +
-int main(int argc, char** argv) +
-+
-    int count=100; +
-    string str = argv[1]; +
-    string res=str.substr(10); +
-    VideoCapture capture(stoi(res), CAP_V4L2); +
-    capture.set(CAP_PROP_FOURCC, VideoWriter::fourcc('U','Y','V','Y')); +
-    capture.set(CAP_PROP_FRAME_WIDTH, 1920); +
-    capture.set(CAP_PROP_FRAME_HEIGHT, 1080); +
-    while (count) +
-    { +
-        Mat frame; +
-        capture >> frame; +
- +
-        if (frame.empty()) { +
-            break; +
-        } +
-        int h = frame.rows; +
-        int w = frame.cols; +
-        const char *name = "video"; +
-        namedWindow(name, 0); +
-        imshow(name, frame); +
-        waitKey(30); +
-        count--; +
-    } +
-    return 0; +
-+
- +
-``` +
- +
-Compile: +
- +
-```shell +
-gcc -o mipi mipi-camera.cpp -lopencv_imgproc -lopencv_core -lopencv_videoio -lopencv_imgcodecs -lopencv_highgui -std=c++11 -std=gnu++11 -Wall -std=c++11 -lstdc++ -I/usr/include/opencv4 +
-``` +
- +
-Test: +
- +
-Capture frame from ''CAM1'': +
- +
-```shell +
-./mipi /dev/video33 +
-``` +
- +
-Capture frame from ''CAM2'': +
- +
-```shell +
-./mipi /dev/video24 +
-``` +
- +
-Capture frame from ''CAM3'': +
- +
-```shell +
-./mipi /dev/video42 +
-``` +
-*/ +
-==== Capture Frame with V4L2 Utils ====+
  
 Follow the steps below to install ''v4l-utils'': Follow the steps below to install ''v4l-utils'':
Line 168: Line 40:
 sudo apt update sudo apt update
 sudo apt install v4l-utils sudo apt install v4l-utils
-``` 
- 
-Capture frame from ''CAM1'': 
- 
-```shell 
-v4l2-ctl -d /dev/video42 --set-fmt-video=width=3840,height=2160,pixelformat=NV12 --stream-mmap=3 --stream-skip=3 --stream-to=/tmp/data42.yuv --stream-count=1 --stream-poll 
 ``` ```
  
Line 179: Line 45:
  
 ```shell ```shell
-v4l2-ctl -d /dev/video33 --set-fmt-video=width=3840,height=2160,pixelformat=NV12 --stream-mmap=3 --stream-skip=3 --stream-to=/tmp/data33.yuv --stream-count=1 --stream-poll+v4l2-ctl -d /dev/video31 --set-fmt-video=width=3840,height=2160,pixelformat=NV12 --stream-mmap=3 --stream-skip=3 --stream-to=/tmp/data31.yuv --stream-count=1 --stream-poll
 ``` ```
  
-Capture frame from ''CAM3'':+Capture frame from ''CAM1'':
  
 ```shell ```shell
-v4l2-ctl -d /dev/video51 --set-fmt-video=width=3840,height=2160,pixelformat=NV12 --stream-mmap=3 --stream-skip=3 --stream-to=/tmp/data51.yuv --stream-count=1 --stream-poll+v4l2-ctl -d /dev/video22 --set-fmt-video=width=3840,height=2160,pixelformat=NV12 --stream-mmap=3 --stream-skip=3 --stream-to=/tmp/data22.yuv --stream-count=1 --stream-poll
 ``` ```
  
-It will capture a ''3840x2160 NV12'' format frame to file ''/tmp/dataXX.yuv''. 
  
- +Preview the captured file:
-Preview the file:+
  
 ```shell ```shell
Line 198: Line 62:
 ``` ```
  
-==== Camera Interfaces Performance ====+==== Camera interfaces performance ====
  
 <tabbox IMX415> <tabbox IMX415>
-  * connect one camera separately:+  * Connect one camera separately:
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ +|    ^    frame rate    ^  
-^  CAM1  |       4K@30fps        |          4K@30fps          +^  CAM1  |       4K@60fps        | 
-^  CAM2        4K@30fps        |          4K@60fps          | +^  CAM2  |       4K@60fps        |
-^  CAM3        4K@60fps        |          4K@60fps          |+
  
-  * connect two cameras to CAM3 and CAM2 simultaneously 
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ +  * Connect two cameras simultaneously:
-^  CAM2  |       4K@30fps        |          4K@60fps          | +
-^  CAM3  |       4K@60fps        |          4K@60fps          |+
  
-  * connect three camera simultaneously: +|    ^   frame rate     
- +^  CAM1  |       4K@60fps        | 
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    +^  CAM2  |       4K@60fps        |
-^  CAM1  |       4K@30fps        |          4K@25fps          +
-^  CAM2        4K@30fps        |          4K@50fps          | +
-^  CAM3        4K@60fps        |          4K@60fps          |+
  
 <tabbox OS08A10> <tabbox OS08A10>
-  * connect one camera separately: +  * Connect one camera separately:
- +
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ +
-^  CAM1  |       4K@30fps        |          4K@30fps          | +
-^  CAM2  |       4K@30fps        |          4K@46fps          | +
-^  CAM3  |       4K@60fps        |          4K@60fps          |+
  
-  * connect two cameras to CAM3 and CAM2 simultaneously+|    ^    frame rate    ^  
 +^  CAM1  |       4K@60fps        | 
 +^  CAM2        4K@60fps        |
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ 
-^  CAM2  |       4K@30fps        |          4K@46fps          | 
-^  CAM3  |       4K@46fps        |          4K@46fps          | 
  
-  * connect three camera simultaneously:+  * Connect two cameras simultaneously:
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    +|    ^   frame rate     
-^  CAM1  |       4K@30fps        |          4K@30fps          +^  CAM1  |       4K@60fps        | 
-^  CAM2  |       4K@30fps        |          4K@46fps          | +^  CAM2  |       4K@60fps        |
-^  CAM3  |       4K@46fps        |          4K@46fps          |+
  
 <tabbox IMX585> <tabbox IMX585>
-  * connect one camera separately:+  * Connect one camera separately:
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ +|    ^    frame rate    ^  
-^  CAM1  |       4K@30fps        |          4K@30fps          +^  CAM1  |       4K@60fps        | 
-^  CAM2        4K@30fps        |          4K@60fps          | +^  CAM2  |       4K@60fps        |
-^  CAM3        4K@60fps        |          4K@60fps          |+
  
-  * connect two cameras to CAM3 and CAM2 simultaneously 
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ +  * Connect two cameras simultaneously:
-^  CAM2  |       4K@30fps        |          4K@60fps          | +
-^  CAM3  |       4K@60fps        |          4K@60fps          |+
  
-  * connect three camera simultaneously:+|    ^   frame rate     ^ 
 +^  CAM1  |       4K@60fps        | 
 +^  CAM2  |       4K@60fps        |
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ 
-^  CAM1  |       4K@18fps        |          4K@15fps          | 
-^  CAM2  |       4K@23fps        |          4K@30fps          | 
-^  CAM3  |       4K@60fps        |          4K@60fps          | 
  
 <tabbox IMX678> <tabbox IMX678>
-  * connect one camera separately: +  * Connect one camera separately:
- +
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ +
-^  CAM1  |       4K@30fps        |          4K@30fps          | +
-^  CAM2  |       4K@30fps        |          4K@60fps          | +
-^  CAM3  |       4K@60fps        |          4K@60fps          |+
  
-  * connect two cameras to CAM3 and CAM2 simultaneously+|    ^    frame rate    ^  
 +^  CAM1  |       4K@60fps        | 
 +^  CAM2        4K@60fps        |
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    ^ 
-^  CAM2  |       4K@30fps        |          4K@60fps          | 
-^  CAM3  |       4K@60fps        |          4K@60fps          | 
  
-  * connect three camera simultaneously:+  * Connect two cameras simultaneously:
  
-|    ^    CAM2 2lane    ^    CAM2 4lane (only V13 or later version support)    +|    ^   frame rate     
-^  CAM1  |       4K@30fps        |          4K@25fps          +^  CAM1  |       4K@60fps        | 
-^  CAM2        4K@30fps        |          4K@50fps          | +^  CAM2  |       4K@60fps        |
-^  CAM3        4K@60fps        |          4K@60fps          |+
  
 </tabbox> </tabbox>
Last modified: 2025/11/26 03:41 by gray