Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:edge2:add-ons:edge2-mipi-camera

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:edge2:add-ons:edge2-mipi-camera [2023/07/04 23:24]
nick
products:sbc:edge2:add-ons:edge2-mipi-camera [2024/12/18 20:43] (current)
gray [Record Video with Gstreamer] Update record command to reach 4k@60fps
Line 1: Line 1:
 +{{indexmenu_n>40}}
  
-===== Edge2 MIPI Camera Usage ===== 
  
-==== Linux ====+====== Edge2 MIPI Camera Usage ======
  
-=== Upgrade System ===+ 
 +===== Linux ===== 
 + 
 +<WRAP important > 
 + 
 +Edge2 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''
 + 
 +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''
 + 
 +You need to reboot the device to take effect. 
 + 
 +</WRAP> 
 + 
 + 
 +==== Upgrade System ====
  
 Please follow the [[products:sbc:edge2:configurations:upgrade-system|documentation ]]to upgrade your system to latest version. Please follow the [[products:sbc:edge2:configurations:upgrade-system|documentation ]]to upgrade your system to latest version.
  
-=== Video Node ===+==== Video Node ===
  
 You can find the video nodes from the table below. You can find the video nodes from the table below.
  
 |        ^  Video Node    ^ |        ^  Video Node    ^
-^  CAM1  |  /dev/video33  | +^  CAM1  |  /dev/video42  | 
-^  CAM2  |  /dev/video24  | +^  CAM2  |  /dev/video33  | 
-^  CAM3  |  /dev/video42  |+^  CAM3  |  /dev/video51  | 
 + 
 +==== Record Video with Gstreamer ====
  
-=== Record Video with Gstreamer === 
  
 Record video from ''CAM1'': Record video from ''CAM1'':
  
 ```shell ```shell
-gst-launch-1.0 v4l2src device=/dev/video33 io-mode=mmap num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video33.mp4+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/! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video42.mp4
 ``` ```
  
Line 28: Line 63:
  
 ```shell ```shell
-gst-launch-1.0 v4l2src device=/dev/video24 io-mode=mmap num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video24.mp4+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/! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video33.mp4
 ``` ```
 +For 4K@60fps, framerate should be set 60/1
  
 Record video from ''CAM3'': Record video from ''CAM3'':
  
 ```shell ```shell
-gst-launch-1.0 v4l2src device=/dev/video42 io-mode=mmap num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video42.mp4+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/! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video51.mp4
 ``` ```
  
-=== Record Video with OpenCV ===+/* 
 +==== Record Video with OpenCV ====
  
 Follow the steps bellow to install OpenCV: Follow the steps bellow to install OpenCV:
Line 45: Line 82:
 sudo apt install libopencv-dev python3-opencv sudo apt install libopencv-dev python3-opencv
 ``` ```
 +
 +''C++'' source code:
  
 ```c++ mipi-camera.cpp ```c++ mipi-camera.cpp
Line 113: Line 152:
 ./mipi /dev/video42 ./mipi /dev/video42
 ``` ```
- +*/ 
-=== Capture Frame with V4L2 API ===+==== Capture Frame with V4L2 Utils ====
  
 Follow the steps below to install ''v4l-utils'': Follow the steps below to install ''v4l-utils'':
Line 126: Line 165:
  
 ```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/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 132: Line 171:
  
 ```shell ```shell
-v4l2-ctl -d /dev/video24 --set-fmt-video=width=3840,height=2160,pixelformat=NV12 --stream-mmap=3 --stream-skip=3 --stream-to=/tmp/data24.yuv --stream-count=1 --stream-poll+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
 ``` ```
  
Line 138: Line 177:
  
 ```shell ```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+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
 ``` ```
  
Line 151: Line 190:
 ``` ```
  
-==== Android ====+===== Android =====
  
 WIP: WIP:
  
Last modified: 2023/07/04 23:24 by nick