AnsweredAssumed Answered

What do the vpuenc parameters "bitrate" and "quant" mean for?

Question asked by Takahiro Yasuda on Jun 25, 2015
Latest reply on Jun 30, 2015 by Takahiro Yasuda

I'm trying to encode video into H.264 with vpuenc element on GStreamer 1.0.

But now I am wondering what the parameters of vpuenc mean, especially "bitrate" and "quant".


(1) "bitrate" Parameter

Is the unit for this "bps"? Or "kbps"?

The description in gst-inspect-1.0 says "bps", but, the parameter's upper limit looks too low for it.


Trying H.264 1280x720 30fps video encode,

it causes "Internal data flow error" at imxv4l2src, if bitrate is over 33,000 (It should be 33kbps, if it is "bps").


If set 32,000 or less, the error doesn't happen.

So it comes from just the "bitrate" setting.


The GStreamer Pipeline and Execution Log

root@imx6qsabresd:~# gst-launch-1.0 \

>     imxv4l2src device="/dev/video0" \

>     ! video/x-raw, width=1280, height=720, framerate=30/1 \

>     ! queue \

>     ! vpuenc bitrate=33000 \

>     ! rtph264pay config-interval=1 \

>     ! queue \

>     ! udpsink port=5000 host=$destIP

====== IMXV4L2SRC: 4.0.2 build on May 12 2015 01:54:29. ======

Setting pipeline to PAUSED ...

[INFO]  Product Info: i.MX6Q/D/S

====== VPUENC: 4.0.2 build on May 12 2015 01:55:03. ======

        wrapper: 1.0.57 (VPUWRAPPER_ARM_LINUX Build on May 11 2015 23:40:00)

        vpulib: 5.4.27


Pipeline is live and does not need PREROLL ...

Setting pipeline to PLAYING ...

New clock: GstSystemClock

ERROR: from element /GstPipeline:pipeline0/GstImxV4l2Src:imxv4l2src0: Internal data flow error.

Additional debug info:

gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:pipeline0/GstImxV4l2Src:imxv4l2src0:

streaming task paused, reason error (-5)

Execution ended after 0:00:00.533507000

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...


(2) "quant" Parameter

I suppose this is a video quality setting for VBR (variable bit rate) encoding.

However, I can't see how it is working.


For H.264, the range of "quant" is, auto setting -1 and 0-51, so I looked -1, 0, and 51 setting (The attachments are the screen shots).

Then, -1 was terribly bad in quality with compressive strain, but no particular difference could be seen between 0 and 51.


What does this stand for?

I've thought either 0 or 51 would be low quality setting, and the other would be high.

What "quant" value did the "-1" choose automatically?


The GStreamer Pipeline to Get Screen Shot for Each vpuenc "quant" Parameter

gst-launch-1.0 \

    imxv4l2src device="/dev/video0" num-buffers=1 \

    ! video/x-raw, width=1280, height=720, framerate=30/1 \

    ! queue \

    ! vpuenc quant=$q\

    ! video/x-h264 \

    ! queue \

    ! vpudec \

    ! queue \

    ! videoconvert ! pngenc ! filesink location="/home/root/cameraCapture_quant$q.png"