[Spice-devel] [spice] streaming: Limit the h264 image compression level
Francois Gouget
fgouget at codeweavers.com
Fri Oct 28 11:11:26 UTC 2016
On Fri, 28 Oct 2016, Frediano Ziglio wrote:
[...]
> > 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 ?
I used the hunk above to force the quantifier to the chosen value and a
spice_debug() statement near the end of the encode_frame() function to
dump the frame size. Then a simple sed turned those traces into a file I
could easily import into a spreadsheet:
$ sed -e 's/.*encoding frame [0-9]* took \([0-9.]*\)ms$/\1/' -e t -e d server.log >sizes.csv
> > 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 ?
Equivalent quality according to my Mark I Eyeball (using something like
PSNR would have been much more complex and would not have solved the
primary issue of what to set qp-max to).
> > 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.
These considerations are all related to vp8enc (either on its own or
relative to x264enc) and are thus irrelevant to whether the quantifier
should be limited when using x264enc.
--
Francois Gouget <fgouget at codeweavers.com>
More information about the Spice-devel
mailing list