Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/build/dts/api/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ device.
WS2812 GPIO driver
* - zephyr,touch
- touchscreen controller device node.
* - zephyr,videoenc
- Video encoder device, typically an H264 or MJPEG video encoder.
* - mcuboot,ram-load-dev
- When a Zephyr application is built to be loaded to RAM by MCUboot, with
:kconfig:option:`CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP_RAM_LOAD`,
Expand Down
73 changes: 73 additions & 0 deletions samples/drivers/video/tcpserversink/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
# Copyright (c) 2025 STMicroelectronics.
# SPDX-License-Identifier: Apache-2.0

mainmenu "TCP camera streaming sample application"

menu "Video capture configuration"

config VIDEO_SOURCE_CROP_LEFT
int "Crop area left value"
default 0
help
Left value of the crop area within the video source.

config VIDEO_SOURCE_CROP_TOP
int "Crop area top value"
default 0
help
Top value of the crop area within the video source.

config VIDEO_SOURCE_CROP_WIDTH
int "Crop area width value"
default 0
help
Width value of the crop area within the video source.
If set to 0, the crop is not applied.

config VIDEO_SOURCE_CROP_HEIGHT
int "Crop area height value"
default 0
help
Height value of the crop area within the video source.
If set to 0, the crop is not applied.

config VIDEO_FRAME_HEIGHT
int "Height of the video frame"
default 0
help
Height of the video frame. If set to 0, the default height is used.

config VIDEO_FRAME_WIDTH
int "Width of the video frame"
default 0
help
Width of the video frame. If set to 0, the default width is used.

config VIDEO_PIXEL_FORMAT
string "Pixel format of the video frame"
help
Pixel format of the video frame. If not set, the default pixel format is used.

config VIDEO_CAPTURE_N_BUFFERING
int "Capture N-buffering"
default 2
help
Framerate versus memory usage tradeoff.
"2" allows to capture while sending data (optimal framerate).
"1" allows to reduce memory usage but capture framerate is lower.
If not set defaults to "2".

config VIDEO_CTRL_HFLIP
bool "Mirror the video frame horizontally"
help
If set, mirror the video frame horizontally

config VIDEO_CTRL_VFLIP
bool "Mirror the video frame vertically"
help
If set, mirror the video frame vertically

endmenu

source "Kconfig.zephyr"
25 changes: 25 additions & 0 deletions samples/drivers/video/tcpserversink/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ This samples requires a video capture device and network support.
- :zephyr:board:`mimxrt1064_evk`
- `MT9M114 camera module`_

- :zephyr:board:`stm32n6570_dk`
with a `MB1854 camera module`_

Wiring
******

Expand All @@ -26,6 +29,12 @@ J35 camera connector. A USB cable should be connected from a host to the micro
USB debug connector (J41) in order to get console output via the freelink
interface. Ethernet cable must be connected to RJ45 connector.

On :zephyr:board:`stm32n6570_dk`, the MB1854 IMX335 camera module must be plugged in
the CSI-2 camera connector. A RJ45 ethernet cable must be plugged in the ethernet CN6
connector. For an optimal image experience, it is advice to embed STM32 image signal
processing middleware: https://github.com/stm32-hotspot/zephyr-stm32-mw-isp.


Building and Running
********************

Expand All @@ -49,6 +58,15 @@ a video software pattern generator is supported by using :ref:`snippet-video-sw-
:goals: build
:compact:

For :zephyr:board:`stm32n6570_dk`, the sample can be built with the following command:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/video/tcpserversink
:board: stm32n6570_dk
:shield: st_b_cams_imx_mb1854
:goals: build
:compact:

Sample Output
=============

Expand All @@ -71,6 +89,13 @@ Example with gstreamer:

For video software generator, the default resolution should be width=320 and height=160.

When using compression support, use this GStreamer command line:

.. code-block:: console

gst-launch-1.0 tcpclientsrc host=192.0.2.1 port=5000 \
! queue ! decodebin ! queue ! fpsdisplaysink sync=false

References
**********

Expand Down
23 changes: 23 additions & 0 deletions samples/drivers/video/tcpserversink/boards/stm32n6570_dk.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Video buffer pool
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=10000000
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=10

# Camera interface
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_PIXEL_FORMAT="pRAA"
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_WIDTH=2592
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_HEIGHT=1944
CONFIG_FPU=y

# Capture
CONFIG_VIDEO_FRAME_WIDTH=1920
CONFIG_VIDEO_FRAME_HEIGHT=1080
CONFIG_VIDEO_PIXEL_FORMAT="NV12"
CONFIG_VIDEO_CAPTURE_N_BUFFERING=2

# Video encoder
CONFIG_VIDEO_STM32_VENC=y
CONFIG_MAIN_STACK_SIZE=4096

# Network buffers
CONFIG_NET_BUF_RX_COUNT=4
CONFIG_NET_BUF_TX_COUNT=8
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Video buffer pool
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=10000000
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=10

# Camera interface
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_PIXEL_FORMAT="pRAA"
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_WIDTH=2592
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_HEIGHT=1944
CONFIG_FPU=y

# Capture
CONFIG_VIDEO_FRAME_WIDTH=1920
CONFIG_VIDEO_FRAME_HEIGHT=1080
CONFIG_VIDEO_PIXEL_FORMAT="NV12"
CONFIG_VIDEO_CAPTURE_N_BUFFERING=2

# Video encoder
CONFIG_VIDEO_STM32_VENC=y
CONFIG_MAIN_STACK_SIZE=4096

# Network buffers
CONFIG_NET_BUF_RX_COUNT=4
CONFIG_NET_BUF_TX_COUNT=8
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 STMicroelectronics.
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
chosen {
zephyr,videoenc = &venc;
};
};

&venc {
status = "okay";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Video buffer pool
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=10000000
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=10

# Camera interface
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_PIXEL_FORMAT="pRAA"
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_WIDTH=2592
CONFIG_VIDEO_STM32_DCMIPP_SENSOR_HEIGHT=1944
CONFIG_FPU=y

# Capture
CONFIG_VIDEO_FRAME_WIDTH=1920
CONFIG_VIDEO_FRAME_HEIGHT=1080
CONFIG_VIDEO_PIXEL_FORMAT="NV12"
CONFIG_VIDEO_CAPTURE_N_BUFFERING=2

# Video encoder
CONFIG_VIDEO_STM32_VENC=y
CONFIG_MAIN_STACK_SIZE=4096

# Network buffers
CONFIG_NET_BUF_RX_COUNT=4
CONFIG_NET_BUF_TX_COUNT=8
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 STMicroelectronics.
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
chosen {
zephyr,videoenc = &venc;
};
};

&venc {
status = "okay";
};
Loading
Loading