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

Next revision
Previous revision
products:sbc:edge2:add-ons:edge2-mipi-camera [2023/07/04 23:18]
nick created
products:sbc:edge2:add-ons:edge2-mipi-camera [2024/01/11 01:51] (current)
jacobe [Other version]
Line 1: Line 1:
 +{{indexmenu_n>40}}
  
-===== Edge2 MIPI Camera Usage ===== 
  
-==== Linux ====+====== Edge2 MIPI Camera Usage ======
  
 +===== Linux =====
  
-=== Video Node ===+==== Upgrade System ==== 
 + 
 +Please follow the [[products:sbc:edge2:configurations:upgrade-system|documentation ]]to upgrade your system to latest version. 
 + 
 +==== 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(5.10.66)    ^  Video Node(5.10.160)   
-^  CAM1  |  /dev/video33 +^  CAM1  |  /dev/video33   /dev/video42  | 
-^  CAM2  |  /dev/video24 +^  CAM2  |  /dev/video24   /dev/video33  | 
-^  CAM3  |  /dev/video42  |+^  CAM3  |  /dev/video42   /dev/video51  |
  
-=== Record Video with Gstreamer ===+==== Record Video with Gstreamer ====
  
-== Record Video ==+<tabbox kernel 5.10.66>
  
 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/video33 io-mode=dmabuf num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video33.mp4
 ``` ```
  
Line 27: Line 32:
  
 ```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/video24 io-mode=dmabuf num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video24.mp4
 ``` ```
  
Line 33: Line 38:
  
 ```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/video42 io-mode=dmabuf num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video42.mp4
 ``` ```
  
-=== Record Video with OpenCV ===+<tabbox Other version>
  
-== Install OpenCV ==+Record video from ''CAM1'': 
 + 
 +```shell 
 +gst-launch-1.0 v4l2src device=/dev/video42 io-mode=dmabuf num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video42.mp4 
 +``` 
 + 
 +Record video from ''CAM2'': 
 + 
 +```shell 
 +gst-launch-1.0 v4l2src device=/dev/video33 io-mode=dmabuf num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video33.mp4 
 +``` 
 + 
 +Record video from ''CAM3'': 
 + 
 +```shell 
 +gst-launch-1.0 v4l2src device=/dev/video51 io-mode=dmabuf num-buffers=300 ! mpph264enc ! h264parse ! qtmux ! filesink location=/tmp/video51.mp4 
 +``` 
 +</tabbox> 
 + 
 +/* 
 +==== Record Video with OpenCV ==== 
 + 
 +Follow the steps bellow to install OpenCV:
  
 ```shell ```shell
Line 44: Line 71:
 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 112: Line 141:
 ./mipi /dev/video42 ./mipi /dev/video42
 ``` ```
 +*/
 +==== Capture Frame with V4L2 Utils ====
  
-=== Capture Frame with V4L2 API === +Follow the steps below to install ''v4l-utils'':
- +
-== Install V4l2 Utils ==+
  
 ```shell ```shell
Line 122: Line 151:
 ``` ```
  
-== Capture Frame ==+<tabbox kernel 5.10.66>
  
 Capture frame from ''CAM1'': Capture frame from ''CAM1'':
Line 141: Line 170:
 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/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
 ``` ```
 +
 +<tabbox Other version>
 +
 +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
 +```
 +
 +Capture frame from ''CAM2'':
 +
 +```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
 +```
 +
 +Capture frame from ''CAM3'':
 +
 +```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
 +```
 +
 +</tabbox>
  
 It will capture a ''3840x2160 NV12'' format frame to file ''/tmp/dataXX.yuv''. It will capture a ''3840x2160 NV12'' format frame to file ''/tmp/dataXX.yuv''.
Line 152: Line 203:
 ``` ```
  
-==== Android ====+===== Android =====
  
 WIP: WIP:
  
Last modified: 2023/07/04 23:18 by nick