[Spice-devel] [spice] streaming: Limit the h264 image compression level

Frediano Ziglio fziglio at redhat.com
Fri Oct 28 10:51:36 UTC 2016


> 
> On Thu, 27 Oct 2016, Francois Gouget wrote:
> 
> > When uncapped x264enc can compress the frames beyond recognition in low
> > bitrate situation. Beyond the set limit the gains are modest and it is
> > better to drop frames to reduce the bit rate further.
> 
> In case anyone is interested, here is a spreadsheet and graphs
> of the frame sizes at various quantizer settings for h264 and VP8.
> 
> http://fgouget.free.fr/tmp/Spice-qpmax-h264.png
> http://fgouget.free.fr/tmp/Spice-qpmax-vp8.png
> 
> http://fgouget.free.fr/tmp/Spice-qpmax.xls
> 
> In both cases I did the test by setting the min and max quantizer to the
> same value, tracing the frame size in encode_frame() and playing the
> same test video. For instance:
> 
> -         gstenc_opts = g_strdup("byte-stream=true aud=true qp-min=15
> qp-max=35 tune=4 sliced-threads=true speed-preset=ultrafast
> intra-refresh=true");
> +         gstenc_opts = g_strdup("byte-stream=true aud=true qp-min=35
> qp-max=35 tune=4 sliced-threads=true speed-preset=ultrafast
> intra-refresh=true");
> 

Which tool did you used ? Some printf on the code ? gst-launch ?

> 
> In my tests a quantizer of 35 in x264enc is roughly equivalent to a
> quantizer of 55 or 60 in vp8enc. The comparison is tricky because at low
> bitrates x264enc tends to result in images that look noisy while vp8enc
> instead tends to erase all details (e.g. you lose most of a face's
> features).
> 

Equivalent you mean looking at byte rate or quality ?

> So it's interesting that at these settings vp8enc beats x264enc handily
> in frame sizes: 1612 down to 984 bytes for vp8enc vs. 5048 to 1715 bytes
> for x264enc. So if you want video on a very low bandwidth link vp8enc
> seems to be the way to go.
> 
> Also whereas at its maximum setting, 63, vp8enc still produces a poor
> quality but still watchable video, at 40 x264enc produces video that's
> annoying to watch and increasing the quantizer a bit more soon produces
> unrecognizable images. This is why I don't plan on limiting the
> quantizer for vp8enc.
> 

I think some of these consideration should go on the commit message.
I think you are right to limit the quantizer value and prefer to drop
frames.

Frediano


More information about the Spice-devel mailing list