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/09/10 01:53]
hyphop [New VIM4 MIPI Camera Usage]
products:sbc:vim4:add-ons:new-vim4-mipi-camera [2024/05/07 22:23]
ivan [Get Frames via Mediactl API]
Line 3: Line 3:
 {{indexmenu_n>52}} {{indexmenu_n>52}}
  
-====== New VIM4 MIPI Camera Usage ======+====== New VIM4 MIPI camera usage ======
  
 <WRAP important > <WRAP important >
Line 11: Line 11:
 ===== 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]].\\
Line 31: Line 31:
 ``` ```
  
-Enable ''IMX415'': [[gh>/khadas/khadas-linux-kernel-dt-overlays/blob/main/overlays/vim4/5.4/vim4n-os08a10.dts]]+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 39: 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''.
 +
 +==== Record video via gstreamer ====
 +
 +<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 ==== ==== Get Frames via Mediactl API ====
Line 81: 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