Adaptive bitrate for MX6Q VPU H264 encoder?

cancel
Showing results for 
Search instead for 
Did you mean: 

Adaptive bitrate for MX6Q VPU H264 encoder?

344 Views
RobbieJiang
Contributor IV

Hi all,

I am working on MX6Q/Linux and have to transfer H.264 encoded video though 4G LTE channel.

Currently, the vpu encoder is configured as CBR (constant bitrate).

However, as 4G channel is very dynamic,

so I would like to have vpu encoder output encoded video bitrate adaptively,

i.e, when the 4G network performance is good, increase the VPU encoder's output bitrate,

and decrease it when 4G network performance degrades.

By the way, I'm using Gstreamer framework to implement both the video encoder/sender and video receiver/decoder.

Basically, the sender pipeline is as follows (except some IP addresses are different):

gst-launch -v gstrtpbin name=rtpbin \
    tvsrc device=/dev/video1 input=2 ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=720,height=576,framerate=25/1' ! mfw_ipucsc ! 'video/x-raw-yuv,format=(fourcc)I420, width=720,height=576,framerate=25/1'! vpuenc codec=avc bitrate=600000 ! video/x-h264,width=720,height=576 ! rtph264pay mtu=512 ! rtpbin.send_rtp_sink_0 \
    rtpbin.send_rtp_src_0 ! udpsink host=192.168.0.86 port=20000  \
    rtpbin.send_rtcp_src_0 ! udpsink host=192.168.0.86 port=20001 sync=false async=false \
    udpsrc port=20002 ! rtpbin.recv_rtcp_sink_0

And  the video receiver pipeline is basically as follows:

gst-launch -v gstrtpbin name=rtpbin \
    udpsrc port=20000 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z0JAHqaAtBJkAA\\=\\=\\,aM4wpIAA\", ssrc=(uint)1525174040, payload=(int)96, clock-base=(uint)3621853829, seqnum-base=(uint)62250' ! rtpbin.recv_rtp_sink_0 \
    rtpbin. ! rtph264depay ! decodebin ! xvimagesink sync=false async=false \
         udpsrc port=20001 ! rtpbin.recv_rtcp_sink_0 \
         rtpbin.send_rtcp_src_0 ! udpsink port=5007 sync=false async=false

Can 'gstrtpbin' provide any helpful information to adjust vpuenc's 'bitrate' property dynamically on the sender side?

Thanks,

Robbie

Labels (3)
0 Kudos
1 Reply

60 Views
joanxie
NXP TechSupport
NXP TechSupport
  • one can set bitrate on the fly, like:
  • +                             {
    +                                             int bitrate = 1000;
    +                                             if (frame_id==100)
    +                                                             vpu_EncGiveCommand(handle, ENC_SET_BITRATE, &bitrate);
    +                             }
                                   ret = vpu_EncStartOneFrame(handle, &enc_param);
  • refer to the vpu api, the parameter bitrate is the target bit rate in kbps. If 0, there is no rate control and pictures are encoded with a quantization parameter equal to quantParam in EncParam


0 Kudos