1.. zephyr:code-sample:: video-capture 2 :name: Video capture 3 :relevant-api: video_interface 4 5 Use the video API to retrieve video frames from a capture device. 6 7Description 8*********** 9 10This sample application uses the :ref:`video_api` to capture frames from a video capture 11device then uses the :ref:`display_api` to display them onto an LCD screen (if any). 12 13Requirements 14************ 15 16This sample needs a video capture device (e.g. a camera) but it is not mandatory. 17Supported camera modules on some i.MX RT boards can be found below. 18 19- `Camera iMXRT`_ 20 21- :zephyr:board:`mimxrt1064_evk` 22- `MT9M114 camera module`_ 23 24- :zephyr:board:`mimxrt1170_evk` 25- `OV5640 camera module`_ 26 27Also :ref:`arduino_nicla_vision_board` can be used in this sample as capture device, in that case 28The user can transfer the captured frames through on board USB. 29 30Wiring 31****** 32 33On :zephyr:board:`mimxrt1064_evk`, the MT9M114 camera module should be plugged in the 34J35 camera connector. A USB cable should be connected from a host to the micro 35USB debug connector (J41) in order to get console output via the freelink interface. 36 37On :zephyr:board:`mimxrt1170_evk`, the OV5640 camera module should be plugged into the 38J2 camera connector. A USB cable should be connected from a host to the micro 39USB debug connector (J11) in order to get console output via the daplink interface. 40 41For :ref:`arduino_nicla_vision_board` there is no extra wiring required. 42 43Building and Running 44******************** 45 46For :zephyr:board:`mimxrt1064_evk`, build this sample application with the following commands: 47 48.. zephyr-app-commands:: 49 :zephyr-app: samples/drivers/video/capture 50 :board: mimxrt1064_evk 51 :shield: dvp_fpc24_mt9m114,rk043fn66hs_ctg 52 :goals: build 53 :compact: 54 55For :zephyr:board:`mimxrt1170_evk`, build this sample application with the following commands: 56 57.. zephyr-app-commands:: 58 :zephyr-app: samples/drivers/video/capture 59 :board: mimxrt1170_evk/mimxrt1176/cm7 60 :shield: nxp_btb44_ov5640,rk055hdmipi4ma0 61 :goals: build 62 :compact: 63 64For :ref:`arduino_nicla_vision_board`, build this sample application with the following commands: 65 66.. zephyr-app-commands:: 67 :zephyr-app: samples/drivers/video/capture 68 :board: arduino_nicla_vision/stm32h747xx/m7 69 :goals: build 70 :compact: 71 72For testing purpose without the need of any real video capture and/or display hardwares, 73a video software pattern generator is supported by the above build commands without 74specifying the shields. 75 76Sample Output 77============= 78 79.. code-block:: console 80 81 Video device: csi@402bc000 82 - Capabilities: 83 RGBP width [480; 480; 0] height [272; 272; 0] 84 YUYV width [480; 480; 0] height [272; 272; 0] 85 RGBP width [640; 640; 0] height [480; 480; 0] 86 YUYV width [640; 640; 0] height [480; 480; 0] 87 RGBP width [1280; 1280; 0] height [720; 720; 0] 88 YUYV width [1280; 1280; 0] height [720; 720; 0] 89 - Default format: RGBP 480x272 90 91 Display device: display-controller@402b8000 92 - Capabilities: 93 x_resolution = 480, y_resolution = 272, supported_pixel_formats = 40 94 current_pixel_format = 32, current_orientation = 0 95 96 Capture started 97 Got frame 0! size: 261120; timestamp 249 ms 98 Got frame 1! size: 261120; timestamp 282 ms 99 Got frame 2! size: 261120; timestamp 316 ms 100 Got frame 3! size: 261120; timestamp 350 ms 101 Got frame 4! size: 261120; timestamp 384 ms 102 Got frame 5! size: 261120; timestamp 418 ms 103 Got frame 6! size: 261120; timestamp 451 ms 104 105 <repeats endlessly> 106 107References 108********** 109 110.. target-notes:: 111 112.. _Camera iMXRT: https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/Connecting-camera-and-LCD-to-i-MX-RT-EVKs/ta-p/1122183 113.. _MT9M114 camera module: https://www.onsemi.com/PowerSolutions/product.do?id=MT9M114 114.. _OV5640 camera module: https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf 115