This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62P-Q1: How to limit the max bitrate when encoding with h265?

Part Number: AM62P-Q1
Other Parts Discussed in Thread: AM62P

Tool/software:

Hi experts,

Customer is having an issue with am62p encoder with sdk 10.0. They found in some complex environment, the bitrate will be very high and encoder will stop working. Below is the setting customer is using. They are using ioctl directly not gstreamer. 

V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1
V4L2_CID_MPEG_VIDEO_BITRATE_MODE: V4L2_MPEG_VIDEO_BITRATE_MODE_VBR
V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: 1
V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP:30
V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED:1
V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOOTHING:1
V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1:2
V4L2_CID_MPEG_VIDEO_HEVC_TMV_PREDICTION:1
V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR:1
V4L2_CID_MPEG_VIDEO_AU_DELIMITER:0
V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP:8
V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP:51
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:format.fmt.pix_mp.pixelformat = fmt; format.fmt.pix_mp.width = w; format.fmt.pix_mp.height = h; format.fmt.pix_mp.colorspace = V4L2_COLORSPACE_REC709;
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:CAPTURE_CODEC
V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD: 5

they have tried to set V4L2_CID_MPEG_VIDEO_BITRATE_MODE to CBR but it dose not work.

They way they check the bitrate output is through rtsp on am62p to send out streams and using vlc to get the stream and get the bitrate statics. 

Regards,

Adam

  • Hi 

    I tried run some gstreamer pipeline to see if I can control bitrate by setting video_bitrate_mode:

    gst-launch-1.0   v4l2src device=/dev/video2 io-mode=dmabuf num-buffers=1000 ! queue !  \
    video/x-raw, width=640,height=480, format=YUY2, framerate=30/1 ! \
    ticolorconvert ! video/x-raw, format=NV12, width=640, height=480, framerate=30/1, interlace-mode=progressive, colorimetry=bt601 ! \
    v4l2h265enc extra-controls="enc, video_gop_size=(int)9, frame_level_rate_control_enable=1,video_bitrate=8000000, video_bitrate_mode=1" ! \
    h265parse ! mp4mux ! filesink location = test.mp4

    And I checked with media info:

    The bitrate goes up to 20,000,000. 

    Is there a way to limit the max bitrate?

    Regards,

    Adam

  • Hi,

    Also, we need a way to dump encoder regs to check if the params are correctly set. Can anyone help with this requirment?

    Regards,

    Adam

  • Hello Adam, 

    I will look into seeing if there are any tools that we have to print that information, but I believe it is abstracted out by GStreamer and V4L2. I will get back to you on this.

    Thanks,
    Sarabesh S. 

  • Hi Adam,

    Changing the vbv_buffer_size to 200 you are able to limit the bitrate and no longer seeing bitrate upto 20Mbps correct? Can this be closed?

    Best Regards,

    Suren