Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim4:add-ons:new-vim4-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
Last revision Both sides next revision
products:sbc:vim4:add-ons:new-vim4-mipi-camera [2023/07/05 03:07]
nick
products:sbc:vim4:add-ons:new-vim4-mipi-camera [2024/05/07 22:23]
ivan [Get Frames via Mediactl API]
Line 1: Line 1:
 +~~tag> VIM4 MIPI OS08A10 IMX415 ISP IP~~
 +
 {{indexmenu_n>52}} {{indexmenu_n>52}}
  
-====== New VIM4 MIPI Camera Usage ======+====== New VIM4 MIPI camera usage ====== 
 + 
 +<WRAP important > 
 +There are two [[../configurations/identify-version#vim4-versions-differences-reference-table| different VIM4 versions ]]: VIM4 and New VIM4. Both versions have different [[/tag/isp|ISP IP core]], so the usage of MIPI camera is also different. 
 +</WRAP>
  
 ===== Linux ===== ===== Linux =====
  
-==== Upgrade System ====+==== Upgrade system ====
  
 Please follow the [[products:sbc:vim4:configurations:upgrade-system|documentation ]]to upgrade your system to latest version. Please follow the [[products:sbc:vim4:configurations:upgrade-system|documentation ]]to upgrade your system to latest version.
  
  
-==== Enable Overlays ====+==== Enable overlays ====
  
-If you want to use the MIPI camera, you need to enable it in [[products:sbc:vim4:configurations:device-tree-overlay|overlays]]. +If you want to use the MIPI camera, you need to enable it in [[products:sbc:vim4:configurations:device-tree-overlay|overlays]].\\ 
 +[[gh>khadas/khadas-linux-kernel-dt-overlays/tree/main/overlays/vim4/5.4]]
  
-  * add ''vim4n-os08a10'' to ''fdt_overlays'' in ''/boot/dtb/amlogic/kvim4.dtb.overlay.env'' to enable ''OS08A10'' +  * Add ''vim4n-os08a10'' to ''fdt_overlays'' in ''/boot/dtb/amlogic/kvim4.dtb.overlay.env'' to enable ''OS08A10'' 
-  * add ''vim4n-imx415'' to ''fdt_overlays'' in ''/boot/dtb/amlogic/kvim4.dtb.overlay.env'' to enable ''IMX415''+  * Add ''vim4n-imx415'' to ''fdt_overlays'' in ''/boot/dtb/amlogic/kvim4.dtb.overlay.env'' to enable ''IMX415'' 
 + 
 +Enable ''OS08A10'': [[gh>/khadas/khadas-linux-kernel-dt-overlays/blob/main/overlays/vim4/5.4/vim4n-os08a10.dts]]
  
-Enable ''OS08A10'': 
 ``` ```
 $ cat /boot/dtb/amlogic/kvim4.dtb.overlay.env  $ cat /boot/dtb/amlogic/kvim4.dtb.overlay.env 
Line 23: Line 31:
 ``` ```
  
-Enable ''IMX415'':+Enable ''IMX415'': [[gh>/khadas/khadas-linux-kernel-dt-overlays/blob/main/overlays/vim4/5.4/vim4n-imx415.dts]]
 ``` ```
 $ cat /boot/dtb/amlogic/kvim4.dtb.overlay.env  $ cat /boot/dtb/amlogic/kvim4.dtb.overlay.env 
Line 31: Line 39:
 And then reboot to take effect. And then reboot to take effect.
  
-==== Video Node ====+==== Video node ====
  
 The video node is ''/dev/media0''. The video node is ''/dev/media0''.
  
-==== Get Frames via Mediactl API ====+==== Record video via gstreamer ====
  
-You can get the test source code here: https://github.com/numbqq/v4l2_media_test+<WRAP important > 
 +Only for 5.15 kernel. 
 +</WRAP> 
 + 
 + 
 +Record video and perform ''H264'' encoding: 
 + 
 +```shell 
 +gst-launch-1.0 v4l2src device=/dev/media0  io-mode=mmap num-buffers=300 ! video/x-raw,format=NV21,width=1920,height=1080,framerate=30/1 ! amlvenc bitrate=8000 ! h264parse ! qtmux ! filesink location=test-h264.mp4 
 + 
 +``` 
 + 
 +Record video and perform ''H265'' encoding: 
 + 
 + 
 +```shell 
 +gst-launch-1.0 v4l2src device=/dev/media0  io-mode=mmap num-buffers=300 ! video/x-raw,format=NV21,width=1920,height=1080,framerate=30/1 ! amlvenc bitrate=8000 ! h265parse ! qtmux ! filesink location=test-h265.mp4 
 + 
 +``` 
 + 
 +==== Get Frames via Mediactl API ====
  
-Download and build the test source code:+Download and build the test source code: [[gh>numbqq/v4l2_media_test]]
  
 <tabbox 5.4 kernel> <tabbox 5.4 kernel>
Line 75: Line 103:
 Preview the file: Preview the file:
  
-```shell +<WRAP important > 
-$ ffplay -f rawvideo -pixel_format nv21 -video_size 3840x2160 /tmp/dst_mif_0.yuv+It doesn't work on VIM4, you need to copy the file and execute the command on your host PC. 
 +</WRAP>
  
 +
 +```shell
 +$ ffplay -f rawvideo -pixel_format nv12 -video_size 3840x2160 /tmp/dst_mif_0.yuv
 ``` ```
 +
  
 ===== Android ===== ===== Android =====
 WIP: WIP:
  
Last modified: 2024/05/18 03:13 by nick