Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim4:add-ons: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
products:sbc:vim4:add-ons:vim4-mipi-camera [2023/07/05 03:02]
nick
products:sbc:vim4:add-ons:vim4-mipi-camera [2024/09/24 03:46] (current)
nick [Preview video on ubuntu desktop]
Line 1: Line 1:
 +~~tag> VIM4 OpenCV V4l2 MIPI ISP ~~
 +
 {{indexmenu_n>50}} {{indexmenu_n>50}}
  
Line 26: Line 28:
  
 ```shell ```shell
-gst-launch-1.0 v4l2src device=/dev/video50 io-mode=mmap num-buffers=300 ! video/x-raw,format=NV12 ! amlvenc bitrate=8000 ! h264parse ! qtmux ! filesink location=test_50.mp4+gst-launch-1.0 -e v4l2src device=/dev/video50 io-mode=mmap num-buffers=300 ! video/x-raw,format=NV21,width=3840,height=2160,framerate=30/! amlvenc bitrate=8000 ! h264parse ! qtmux ! filesink location=test_50.mp4
 ``` ```
  
Line 137: Line 139:
 ./mipi /dev/video50 ./mipi /dev/video50
 ``` ```
-===== Android ===== 
-WIP: 
  
-====== New VIM4 MIPI Camera Usage ======+==== Preview video on ubuntu desktop ====
  
-===== Linux =====+<tabbox Ubuntu 24.04>
  
-==== Enable Overlays ====+You can use gstreamer ''waylandsink'' to preview the video on Ubuntu Wayland desktop:
  
-If you want to use the MIPI camera, you need to enable it in [[products:sbc:vim4:configurations:device-tree-overlay|overlays]] +```shell 
- +gst-launch-1.0 v4l2src device=/dev/video50 io-mode=mmap  ! video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! videoconvert ! waylandsink
-  * 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'' +
- +
-Enable ''OS08A10'':+
 ``` ```
-$ cat /boot/dtb/amlogic/kvim4.dtb.overlay.env  
-fdt_overlays=vim4n-os08a10 
-``` 
- 
-Enable ''IMX415'': 
-``` 
-$ cat /boot/dtb/amlogic/kvim4.dtb.overlay.env  
-fdt_overlays=vim4n-imx415 
-``` 
- 
-And then reboot to take effect. 
- 
-==== Video Node ==== 
- 
-The video node is ''/dev/media0''. 
- 
-==== Get Frames via Mediactl API ==== 
- 
-You can get the test source code here: https://github.com/numbqq/v4l2_media_test 
- 
-Download and build the test source code: 
- 
-<tabbox 5.4 kernel> 
  
 +You can use the command below to check display fps:
  
 ```shell ```shell
-$ git clone https://github.com/numbqq/v4l2_media_test +gst-launch-1.0 -v v4l2src device=/dev/video50 io-mode=mmap ! video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! fpsdisplaysink video-sink=waylandsink sync=false text-overlay=false
-$ cd v4l2_media_test +
-$ git checkout e0482794337c01935593a91b621f9c42123cf175 +
-$ g++ v4l2_test_raw.cpp -o v4l2_test_raw  -Wall -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -pthread -fPIE -lispaml -ldl -lmediaAPI -ltuning -lm -fPIC -D_FORTIFY_SOURCE=2 -O3 +
-$ ls v4l2_test_raw +
-v4l2_test_raw+
 ``` ```
  
-<tabbox 5.15 kernel>+<tabbox Ubuntu 22.04> 
 + 
 +You can use gstreamer ''clutterautovideosink'' to preview the video on Ubuntu Wayland desktop:
  
 ```shell ```shell
-$ git clone https://github.com/numbqq/v4l2_media_test +gst-launch-1.0 v4l2src device=/dev/video50 io-mode=mmap ! video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! clutterautovideosink
-$ cd v4l2_media_test +
-$ g++ v4l2_test_raw.cpp -o v4l2_test_raw  -Wall -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -pthread -fPIE -lispaml -ldl -lmediaAPI -ltuning -llens -lm -fPIC -D_FORTIFY_SOURCE=2 -O3 +
-$ ls v4l2_test_raw +
-v4l2_test_raw+
 ``` ```
  
-</tabbox> +You can use the command below to check display fps:
- +
-Test:+
  
 ```shell ```shell
-$ ./v4l2_test_raw -0 -n 10 -m /dev/media0+gst-launch-1.0 -v v4l2src device=/dev/video50 io-mode=mmap ! video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! fpsdisplaysink video-sink=clutterautovideosink sync=false text-overlay=true
 ``` ```
  
-It will capture 10 frames to file ''/tmp/dst_mif_0.yuv''.+You press ''Alt + F7'' and then move mouse to move the windown.
  
-Preview the file: +</tabbox>
- +
-```shell +
-$ ffplay -f rawvideo -pixel_format nv21 -video_size 3840x2160 /tmp/dst_mif_0.yuv +
- +
-```+
  
 ===== Android ===== ===== Android =====
 WIP: WIP:
 +
  
Last modified: 2023/07/05 03:02 by nick