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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

3,606 Views
takahiroyasuda
Contributor II

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

        firmware: 3.1.1.46061

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"

Labels (3)
2 Replies

2,515 Views
joanxie
NXP TechSupport
NXP TechSupport

1) it seems your bitrate is too lower, try to set bitrate=5000000(5M)

2) refer to the vpuenc,

h.264 should be 0-51, did you try to use vpuenc, no quant, how about the quality? the same as quant=-1? if yes, I will test on my board.

0 Kudos

2,515 Views
takahiroyasuda
Contributor II

Thank you for your reply.

1) it seems your bitrate is too lower, try to set bitrate=5000000(5M)

"bitrate=5000000" made the same failure, imxv4l2src's internal data flow error.

Rather smaller bitrate value, e.g. "bitrate=5000", does work.

(So I am wondering the unit might be "kbps".)

2) refer to the vpuenc,

h.264 should be 0-51, did you try to use vpuenc, no quant, how about the quality?

the same as quant=-1? if yes, I will test on my board.

"quant=-1" is automatic setting, and it's the default value.

The quality of no-quant setting is the same of quant=-1.

gst-inspect-1.0 vpuenc (Extract)

  quant              : set quant value: H.264(0-51), Mpeg4/H.263(1-31) (-1 for automatic)

                        flags: readable, writable

                        Integer. Range: -1 - 51 Default: -1