-
Notifications
You must be signed in to change notification settings - Fork 8.1k
video: add video compression support to tcpserversink sample #95862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
video: add video compression support to tcpserversink sample #95862
Conversation
Good idea to split dependencies out of #92884 to help review. Is the current PR expected to be reviewed now? I am asking just because I did not see You may be interested in this PR which introduces H.264 into the Thank you for bringing this forward! |
926cd0c
to
0fa7a7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this interesting support for the 1st Zephyr H.264 encoding sample !
The important thing to me is the estimated encoded buffer size which should be done in a more robust way, I think.
0fa7a7e
to
a6f426c
Compare
a6f426c
to
e0c6dad
Compare
All comments addressed so far... |
a2db919
to
4adeb03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to avoid having this app always use the VENC in case of usage on the N6, I tried to have snippets in order to select the video encoder.
As an example I pushed a commit here avolmat-st@993aea3 as well a commit which removes unnecessary bits from the board specific conf in tcpserversink sample:
avolmat-st@6a76fac
I also made a similar snippet for the jpegenc which I've pushed in the stm32-jpeg PR (96678) in this commit 078a3a0
samples/drivers/video/tcpserversink/boards/stm32n6570_dk_stm32n657xx_fsbl.conf
Outdated
Show resolved
Hide resolved
samples/drivers/video/tcpserversink/boards/stm32n6570_dk_stm32n657xx_sb.conf
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objections from my side on the new chosen
Sounds good. The snippet also helps to reduce the code duplication (#95862 (comment)). Could we put other configs into the snippet's .conf file or they are board-specific and cannot be generalized @avolmat-st @hfruchet-st ?
|
I think the snippet should be normally as much as possible application unrelated, so for example I don't think the NET_BUF part should be in there since it seems really related to the tcpserversink. Is that right @hfruchet-st ? For the MAIN_STACK_SIZE, don't know, I feel as well that this is also quite application related part. I actually have an issue with the snippet which is that this set the ENCODED_FRAME_FORMAT config in it, which is a config only defined in the tcpserversink sample app and this leads to CI warnings. |
4adeb03
to
7fe36f5
Compare
New version pushed with sizeimage => size for video_format, new snippet to allow selection of venc H264 video encoder but also futur JPEG encoder, cleanup in configs due to use of camera shield and snippet. |
7fe36f5
to
7c070dc
Compare
Rebased |
7cf6949
to
a339a58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for one more round of editing. Here is one more round of review with minor details proposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks a lot !! Tested ok also with the JPEG encoder PR on the N6.
Add the zephyr,videoenc chosen node documentation for hardware video encoder support such as H264 or MJPEG video encoder. Signed-off-by: Hugues Fruchet <[email protected]>
Addition of a snippet in order to enable and configure the STM32 VENC encoder Signed-off-by: Alain Volmat <[email protected]>
Change printk debug traces to LOG_*. Signed-off-by: Hugues Fruchet <[email protected]>
Sync with video capture sample. Signed-off-by: Hugues Fruchet <[email protected]>
Allow to configure the number of allocated capture frames. This allows to make tradeof between framerate versus memory usage. 2 buffers allows to capture while sending data (optimal framerate). 1 buffer allows to reduce memory usage but capture framerate is lower. Signed-off-by: Hugues Fruchet <[email protected]>
Add video compression support to lowerize network bandwidth. To visualise camera content on host PC, use GStreamer command line: $> gst-launch-1.0 tcpclientsrc host=<board ip address> port=5000 ! \ decodebin ! autovideosink sync=false Signed-off-by: Hugues Fruchet <[email protected]>
Add configuration files for the stm32n6570_dk board. This enables streaming over ethernet of the images captured by MB1854 camera module compressed in 1920x1080 H264 video bitstream. Signed-off-by: Hugues Fruchet <[email protected]>
a339a58
to
ddd242f
Compare
|
} | ||
|
||
/* Alloc output buffer */ | ||
size = fmt.size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed this already landed on this PR, but #97197 and/or #92884 are dependencies that introduce .size
in struct video_format
.
Sorry about this inconsistency.
Nothing is broken as as @avolmat-st pointed me, it is not enabled by any board, so CI is unaffected.
Any introduction of zephyr,videoenc
chosen node will both reveal that bug and fix it as size
is required for video encoder support.
Next time I will need to add a DNM
flag after +1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P.S. This was not something the release team could have caught as very specific to the discussions on other PRs.
This PR adds support of camera streaming with compression of camera frames in video format such as H264 instead of sending big raw uncompressed frames, reducing drastically the network bandwidth needed for such use-case.
This video compression mode is enabled when a video encoder is found in device-tree, such as the VENC video encoder driver of the STM32N6 platform [1].
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 adviced to embed the STM32 image signal processing middleware [2].
To build sample: (flash using ST-Link and boot with FSBL [3])
The default configuration allows to capture and stream 1080p camera content from STM32N6 which can be received, decoded and displayed by an host PC using a GStreamer command line:
[1] #92884
[2] https://github.com/stm32-hotspot/zephyr-stm32-mw-isp
[3] https://docs.zephyrproject.org/latest/boards/st/stm32n6570_dk/doc/index.html