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.

SK-AM62P-LP: Gray figure occurs at room temperature and the bit rate is out of control in special scenarios

Part Number: SK-AM62P-LP
Other Parts Discussed in Thread: AM62P

Tool/software:

Hi,experts:

   We now have two problems:

       First, when encountering special scenes, the coded stream will spend the screen, and it will be accompanied by some gray graphs.

       
      Second, the bit rate cannot be controlled, in some noisy scenes, the bit rate may rise to about 20Mb, the use of fixed rate mode can not control the upper limit of the bit rate.

        Below is the five-channel video stream resolution and bit rate and encode param, video stream GOP is 5,

       {“track", width, height, bitrate} // rtsptrack,width,height,bitrate
     {"9",   1216,  864, 5000000},  
        {"14",   640,  864, 5000000},  
        {"51",   448,  608, 4000000},  
        {"1",   1920, 1080, 5000000},   
        {"52",  1920, 1080, 5000000},   

param value
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 default

      

   We use the system ioctl for coding, not gstreamer. We dump the relevant register information, but we do not know the meaning of the register. Ask a TI expert to help see if these register values are abnormal, or can provide gray plot and rate control solutions。

gstreamer does not appear grey at room temperature, is there a way we can set the parameters to be consistent with gstreamer?

    

Attached is the vpu register information we dumped:

    one minute after the avm(using encode) process is shut down, the data is read1832.上电一分钟关闭avm进程后读取.txt

    direct reading after one minute of power-on2084.上电一分钟直接读取.txt

    one minute read after the second power-on4150.上电一分钟直接读取02.txt

     

  • Hi Qinghong,

    Gray color appearing on screen has been fixed in the newer driver version. See below commit.

    https://git.linuxtv.org/media.git/commit/drivers/media/platform/chips-media/wave5?id=6bae4d5053da634eecb611118e7cd91a677a4bbf

     As you are using an older version, please add this to the existing driver, rebuild it, and deploy to your environment.

    Best Regards,

    Suren

  • Hi Qinghong,

    To regulate the Bitrate, we have tried these parameters and here are few things that you could try and change.

    • set V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE to 1
      • Will enable CTU level RC (rate control) as well
      • CTU is lowest level of processing in HEVC, enabling RC here allows the most granular control over QP and bit allocation
    • Choose a lower level
      • From the e2e I see that they are using a bunch of different resolutions
      • For the lower resolutions (640x864, 448x608), they could probably go down to 3.1 and see no change in quality
      • I think for the resolutions above that, 4.1 is good
    • Pick a higher min qp value
      • They have their min set to 8, have they tried going up to 15 to see if this is better balance of quality and efficiency?
      • I am saying 15 as an arbitrary value, but trialing different QPs could lead to lower bitrates. They need to find the values that fit their use case.
    • Add in background detection to help save bits
      • V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION to 1
      • This tool is helpful in cases where inter-frames have common background and qp is lower (if they decide to stay with 8 as their min)
    • Lastly, and most importantly, I would tell them to set the VBV_BUFFER_SIZE to the min (10) with using constant bitrate mode
      • V4L2_CID_MPEG_VIDEO_VBV_SIZE to 10
      • The driver defaults to 1000, but this is too much tolerance for the given use case. When I drop this value down for this customers resolution, the bitrate range is significantly smaller and I don’t see any large spikes

     

    This was the final pipeline I used to do my testing in the 10.0 SDK, let me know if you have any comments on it:

    gst-launch-1.0 v4l2src device=/dev/video2 io-mode=dmabuf num-buffers=1000 ! queue ! video/x-raw,format=YUY2,width=640,height=480,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,vbv_buffer_size=10,prepend_sps_and_pps_to_idr=1,hevc_strong_intra_smoothing=1,hevc_minimum_qp_value=8,hevc_maximum_qp_value=51,hevc_max_num_of_candidate_mvs=2, hevc_constant_intra_prediction=1,generate_access_unit_delimiters=0,hevc_tmv_prediction=1,background_detection=1" ! video/x-h265,level='(string)4.1' ! h265parse ! mp4mux ! filesink location=bg_cbr.mp4

    Hope this helps.

    Best Regards,

    Suren

  • Hi,Suren,

        This commit is about the update of the decoder,we only use encode for am62p. So this may not solve out problem.

    Best Regards,

    Qinghong

  • Hi Qinghong,

    The Gray screen was an issue with RTSP and nothing related to encoder. Can this be closed?

    Best Regards,

    Suren