2025-07-09 10:25 PM - edited 2025-07-09 10:33 PM
Hi everyone,
I was exploring the VENC_SDCard example from STM32CubeN6 v1.2.0, and I was successfully able to record and store video to the SD card after making a few necessary changes mentioned here.
Now, I want to record and store the video in grayscale format. After modifying the MX_DCMIPP_Init() function in main.c and the BSP_LCD_InitEx() function in stm32n6570_discovery_led.c, I can correctly see the grayscale video output on the display.
However, when I try to record this grayscale stream, the resulting video is distorted.
(Attached it)
Upon debugging, I suspect the issue originates from the following line in encoder_prepare():
preproc_cfg.inputType = H264ENC_RGB565;
The inputType is still set to RGB, and after checking the h264encapi.h header file, I found the following enum for H264EncPictureType on line 159:
typedef enum
{
H264ENC_YUV420_PLANAR = 0, /**< YYYY... UUUU... VVVV... */
H264ENC_YUV420_SEMIPLANAR, /**< YYYY... UVUVUV... */
H264ENC_YUV420_SEMIPLANAR_VU, /**< YYYY... VUVUVU... */
H264ENC_YUV422_INTERLEAVED_YUYV, /**< YUYVYUYV... */
H264ENC_YUV422_INTERLEAVED_UYVY, /**< UYVYUYVY... */
H264ENC_RGB565, /**< 16-bit RGB 16bpp */
H264ENC_BGR565, /**< 16-bit RGB 16bpp */
H264ENC_RGB555, /**< 15-bit RGB 16bpp */
H264ENC_BGR555, /**< 15-bit RGB 16bpp */
H264ENC_RGB444, /**< 12-bit RGB 16bpp */
H264ENC_BGR444, /**< 12-bit RGB 16bpp */
H264ENC_RGB888, /**< 24-bit RGB 32bpp */
H264ENC_BGR888, /**< 24-bit RGB 32bpp */
H264ENC_RGB101010, /**< 30-bit RGB 32bpp */
H264ENC_BGR101010, /**< 30-bit RGB 32bpp */
H264ENC_SP_101010, /**< yuv420 10bit, semi-planar */
H264ENC_P010 /**< yuv420 10bit, planar */
} H264EncPictureType;
Unfortunately, there's no entry for an L8 format.
How should I proceed to enable grayscale video recording and save it properly to the SD card? Any suggestions would be greatly appreciated.
Thank you for your support!