[FFmpeg-user] Bad Quality Webm video with alpha
Carl Eugen Hoyos
ceffmpeg at gmail.com
Fri Sep 28 00:21:33 EEST 2018
2018-09-27 21:27 GMT+02:00, Rafael Mancini <rafaelbmancini at gmail.com>:
> So, after altering the command line I got a much better result with this:
>
> *ffmpeg -r 24 -i "input 1920x1080.mov" -c:v libvpx-vp9 -crf 30 -b:v 0
> "output 1920x1080.webm"*
>
> The quality is a lot better, but still not exactly what I wanted... very
> close, but not quiet. The file size is good: 4.4MB.
>
> This is very usefull to generate videos for HTM5 with alpha channel, so you
> can create interaction layers on top of any template.
>
> I wish I could set the -crf value to 20. That's where I got a very good
> result, but the file gets too big: +30MB.
There are still values between 20 and 30 to test ;-)
> Below is the complete output. Any ideas on how to increase quality and
> decrease file size?
Did you already try png encoding? (It supports some options that may
be helpful.)
If this is really something like animation, you can try to encode to
apng (gif would be better but gif with transparency is sadly broken),
with pal8 pix_fmt, see the two filters palettegen and paletteuse:
https://ffmpeg.org/ffmpeg-filters.html#palettegen-1
(To repeat: gif would be what you want but it does not work
correctly with transparency, there is a patch that you could use in
your own tree if you can compile yourself).
If the input is animation (-like), both filesize and quality are
superior with this solution.
If you need vp9, you have no choice than to find the ideal bitrate,
and use two-pass encoding and a slow preset (there should be an
animation tuning), the end-result is supposed to be better than
crf.
Carl Eugen
More information about the ffmpeg-user
mailing list