cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6570-DK VENC_RTSP_Server not working at 30 fps

mlinka
Associate

Hi,

I'm currently working with the STM32N6570-DK and the VENC_RTSP_Server Application from the STM32CubeN6 package.

I'm trying to evaluate the VENC peripheral h264 performance.

By default, the example application runs at 20 fps, I would like to take it to 30 fps. VENC, DCMIPP and IMX335 camera should support it.

My question is : What do I need to modify in the example code to be able to achieve 30 fps ?

(appart from the obvious "#define ...")

 

Here is what I've already tried : 

  • I first tried to simply modify  line 52 and line 109 in venc_app.c :
52: #define FRAMERATE 30
109: IMX335_SetFramerate(Camera_CompObj, 30);

This gives the problem I have at 30 fps (no problem at 25 fps), the video cuts and distorts like this :

Capture.PNG

  • I then tried to change the DCMIPP clock divider and CSI bitrate with the following lines:
line 346: PeriphClkInit.ICSelection[RCC_IC17].ClockDivider = 4;
line 373: csiconf.PHYBitrate = DCMIPP_CSI_PHY_BT_2000;
  •  I also tried to set the IMX camera frequency by adding the following at line 108:
IMX335_SetFrequency(Camera_CompObj, IMX335_INCK_24MHZ);
  •  Finally, I tried messing around with H264 encoding parameters such as "gopLen" line 206 and "bitPerSecond" line 204.

Nothing I've tried so far solves the problem.

 

To display the video stream I use ffplay with the following command : 

ffplay -fflags nobuffer -max_delay 0 -flags low_delay -vf "drawtext=fontfile=C\\:/Windows/fonts/consola.ttf:fontsize=72:fontcolor='white':timecode='00\:00\:00\:00':rate=25:text='TCR\:':boxcolor=0x000000AA:box=1:x=480-text_w/2:y=720-text_h" rtsp://192.168.0.2:554

I also tried with my colleague's gstreamer pipeline but it produces the same result.

 

Any suggestions ?

 

Thank you in advance for your help.

Maxime.

 

1 REPLY 1
DanielS
ST Employee

Hello Maxime,

The bug you described seems to originate from an encoding that does not start at the beginning of a frame.

The VENC_RTSP_Server app is designed in a somewhat simplistic way. It uses "Slice mode," which has the advantage of lowering the memory footprint but the disadvantage of being somewhat subtle and sensitive to real-time constraints.

That being said, the artifact should disappear by applying the attached patch (it applies to V1.1.0). It involves ensuring that the encoding starts at the beginning of the frame.

Best regards,
Daniel