Re: how to speed up libvpx?

4,924 views
Skip to first unread message

Basil Mohamed Gohar

unread,
Feb 17, 2013, 9:29:27 PM2/17/13
to webm-d...@webmproject.org
On 02/17/2013 02:50 AM, michael....@binarykitchen.com wrote:
> hello guys
>
> i find the libvpx encoder really very slow compared to h264 encoders.
> aren't there any speed tricks to improve encoding speed beside setting
> deadline to 'rt'?
>
> cheers
> michael
For what it's worth, libvpx in recent commits via git appears to be
significantly faster than previous releases. I haven't compared the
encoded output, so take that cautiously, but it does appear that speed
is incrementally being improved by continuous work.

--
Libre Video
http://librevideo.org

John Koleszar

unread,
Feb 26, 2013, 12:27:06 PM2/26/13
to WebM Discussion
There's a parameter that maps to what we call "cpu used" internally, but I don't know what avconv calls it off hand. You can set it to a negative value -1 (slowest) to -16 (fastest) in addition to setting -deadline rt, and pick the tradeoff you want. Which x264 preset are you trying to mimic?


On Tue, Feb 26, 2013 at 1:38 AM, <michael....@binarykitchen.com> wrote:
For what it's worth, libvpx in recent commits via git appears to be
significantly faster than previous releases.  I haven't compared the
encoded output, so take that cautiously, but it does appear that speed
is incrementally being improved by continuous work.

I did a recent git pull and recompiled libvpx. Unfortunately it's still very very slow.

Here an example. I'm trying to convert a sequence of images to webm:
avconv -f image2 -r 13 -i /tmp/test/input/%d.jpg -an -b:v 256k -r 25 -y /tmp/test/output/video.webm -loglevel info -c:v libvpx -deadline rt

The encoding process is very slow. If I use x264 instead with different parameters, it's 8 times faster. How can I make it faster with libvpx?

Cheers
Michael

--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webm-discuss...@webmproject.org.
To post to this group, send email to webm-d...@webmproject.org.
Visit this group at http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.
For more options, visit https://groups.google.com/a/webmproject.org/groups/opt_out.
 
 

Ronald Bultje

unread,
Feb 26, 2013, 12:29:02 PM2/26/13
to webm-d...@webmproject.org
It's -cpu-used in libav/ffmpeg also (e.g. ffmpeg -i infile -vcodec
libvpx -cpu-used -1 outfile).

Ronald

James Zern

unread,
Feb 26, 2013, 3:27:15 PM2/26/13
to webm-d...@webmproject.org
On Tue, Feb 26, 2013 at 9:29 AM, Ronald Bultje <rbu...@google.com> wrote:
> It's -cpu-used in libav/ffmpeg also (e.g. ffmpeg -i infile -vcodec
> libvpx -cpu-used -1 outfile).
>
Note ffmpeg will dump these with '-h full'.
You might also see a slight bump with '-mb_threshold 1' as well as
increasing the thread count (-threads # / -threads auto).

Michael Heuberger

unread,
Feb 26, 2013, 7:18:00 PM2/26/13
to webm-d...@webmproject.org
Thanks John

There is no documentation saying avconv supports --cpu-used so no idea if it has any effect. Does --cpu-used really work with avconv?

I'm trying to mimic the fast preset of x264.

Any help, any clues is very very welcome.

Michael
-- 

Binary Kitchen
Michael Heuberger
4c Dunbar Road
Mt Eden
Auckland 1024
(New Zealand)

Mobile (text only) ...  +64 21 261 89 81
Email ................  mic...@binarykitchen.com
Website ..............  http://www.binarykitchen.com

Michael Heuberger

unread,
Feb 26, 2013, 7:32:58 PM2/26/13
to webm-d...@webmproject.org
thanks, i tried that but only gained a speed improvement of about 5%.
still too slow :/

John Koleszar

unread,
Feb 26, 2013, 7:36:45 PM2/26/13
to WebM Discussion
did you try any other values for -cpu-used besides -1?


On Tue, Feb 26, 2013 at 4:32 PM, Michael Heuberger <michael....@binarykitchen.com> wrote:
thanks, i tried that but only gained a speed improvement of about 5%. still too slow :/


On 27/02/13 06:29, Ronald Bultje wrote:
It's -cpu-used in libav/ffmpeg also (e.g. ffmpeg -i infile -vcodec
libvpx -cpu-used -1 outfile).

Ronald

On Tue, Feb 26, 2013 at 9:27 AM, John Koleszar <jkol...@google.com> wrote:
There's a parameter that maps to what we call "cpu used" internally, but I
don't know what avconv calls it off hand. You can set it to a negative value
-1 (slowest) to -16 (fastest) in addition to setting -deadline rt, and pick
the tradeoff you want. Which x264 preset are you trying to mimic?


On Tue, Feb 26, 2013 at 1:38 AM, <michael.heuberger@binarykitchen.com>
wrote:
For what it's worth, libvpx in recent commits via git appears to be
significantly faster than previous releases.  I haven't compared the
encoded output, so take that cautiously, but it does appear that speed
is incrementally being improved by continuous work.

I did a recent git pull and recompiled libvpx. Unfortunately it's still
very very slow.

Here an example. I'm trying to convert a sequence of images to webm:

avconv -f image2 -r 13 -i /tmp/test/input/%d.jpg -an -b:v 256k -r 25 -y
/tmp/test/output/video.webm -loglevel info -c:v libvpx -deadline rt


The encoding process is very slow. If I use x264 instead with different
parameters, it's 8 times faster. How can I make it faster with libvpx?


Cheers
Michael

--
You received this message because you are subscribed to the Google Groups
"WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an

--
You received this message because you are subscribed to the Google Groups
"WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an

--

Binary Kitchen
Michael Heuberger
4c Dunbar Road
Mt Eden
Auckland 1024
(New Zealand)

Mobile (text only) ...  +64 21 261 89 81
Email ................  mic...@binarykitchen.com
Website ..............  http://www.binarykitchen.com

--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webm-discuss+unsubscribe@webmproject.org.

Michael Heuberger

unread,
Feb 26, 2013, 7:42:14 PM2/26/13
to webm-d...@webmproject.org
Yes. Interestingly -5 is a little bit faster than -1 or -16

No idea why ...


On 27/02/13 13:36, John Koleszar wrote:
did you try any other values for -cpu-used besides -1?
On Tue, Feb 26, 2013 at 4:32 PM, Michael Heuberger <michael....@binarykitchen.com> wrote:
thanks, i tried that but only gained a speed improvement of about 5%. still too slow :/


On 27/02/13 06:29, Ronald Bultje wrote:
It's -cpu-used in libav/ffmpeg also (e.g. ffmpeg -i infile -vcodec
libvpx -cpu-used -1 outfile).

Ronald

On Tue, Feb 26, 2013 at 9:27 AM, John Koleszar <jkol...@google.com> wrote:
There's a parameter that maps to what we call "cpu used" internally, but I
don't know what avconv calls it off hand. You can set it to a negative value
-1 (slowest) to -16 (fastest) in addition to setting -deadline rt, and pick
the tradeoff you want. Which x264 preset are you trying to mimic?


On Tue, Feb 26, 2013 at 1:38 AM, <michael....@binarykitchen.com>
wrote:
For what it's worth, libvpx in recent commits via git appears to be
significantly faster than previous releases.  I haven't compared the
encoded output, so take that cautiously, but it does appear that speed
is incrementally being improved by continuous work.

I did a recent git pull and recompiled libvpx. Unfortunately it's still
very very slow.

Here an example. I'm trying to convert a sequence of images to webm:

avconv -f image2 -r 13 -i /tmp/test/input/%d.jpg -an -b:v 256k -r 25 -y
/tmp/test/output/video.webm -loglevel info -c:v libvpx -deadline rt


The encoding process is very slow. If I use x264 instead with different
parameters, it's 8 times faster. How can I make it faster with libvpx?


Cheers
Michael

--
You received this message because you are subscribed to the Google Groups
"WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an

--
You received this message because you are subscribed to the Google Groups
"WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an

--

Binary Kitchen
Michael Heuberger
4c Dunbar Road
Mt Eden
Auckland 1024
(New Zealand)

Mobile (text only) ...  +64 21 261 89 81
Email ................  mic...@binarykitchen.com
Website ..............  http://www.binarykitchen.com

--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webm-discuss...@webmproject.org.
--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webm-discuss...@webmproject.org.

John Koleszar

unread,
Feb 26, 2013, 7:43:37 PM2/26/13
to WebM Discussion
You need to specify realtime too. You're running in the good mode, which only has 5 or 6 speed steps.

Michael Heuberger

unread,
Feb 26, 2013, 7:45:35 PM2/26/13
to webm-d...@webmproject.org
I already have realtime (-deadline rt), see command:

avconv -f image2 -r 13 -i %d.jpg -an -b:v 256k -r 25 -y video.webm -loglevel info -c:v libvpx -deadline rt -cpu-used -5

Or am I doing it wrong?
You received this message because you are subscribed to a topic in the Google Groups "WebM Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/a/webmproject.org/d/topic/webm-discuss/1cLXjVq06Yc/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to webm-discuss...@webmproject.org.

Michael Heuberger

unread,
Feb 26, 2013, 7:50:35 PM2/26/13
to webm-d...@webmproject.org
Thanks James but I'm afraid, mb_threshold and threads to not make much
speed difference (< 5%)

James Zern

unread,
Feb 26, 2013, 9:40:34 PM2/26/13
to webm-d...@webmproject.org
On Tue, Feb 26, 2013 at 4:50 PM, Michael Heuberger
<michael....@binarykitchen.com> wrote:
> Thanks James but I'm afraid, mb_threshold and threads to not make much speed
> difference (< 5%)
>
If you're params are still out of order then I wouldn't expect a difference.
Compare:
$ ffmpeg -i input -y output.webm -deadline realtime
with
$ ffmpeg -i input -y -deadline realtime output.webm

In the first the deadline will be ignored and the codec defaults will
be used. You can use -loglevel debug to see the vp8 encoder settings
to make sure your command line is having the desired effect.

Michael Heuberger

unread,
Feb 26, 2013, 11:28:02 PM2/26/13
to webm-d...@webmproject.org
yeeeeeeeahh, that was the problem!

the correct order fixed it. many many thanks james :)
Reply all
Reply to author
Forward
0 new messages