<p>Try something like this:</p>

<p><code>ffmpeg -f image2 -framerate 30 -i img%05d.png -c:v libvpx-vp9 -b:v 0 -pix_fmt yuv420p -crf 30 -cpu-used 1 -tile-columns 2 -threads 8 -row-mt 1 output.webm</code></p>

<ul>
<li><p>Placing <code>-framerate 30</code> before the input specifies it as the frame rate of the input to be 30. This is then inherited as the output frame rate as well.</p></li>
<li><p><code>-c:v libvpx-vp9</code> specifies that you want to use VP9. If you want to use VP8, use <code>-c:v libvpx</code> instead. VP8 has lower compression efficiency but is also less demanding to decode.</p></li>
<li><p><code>-b:v 0</code> is required for <code>-crf</code> to work the way most people expect when using libvpx or libvpx-vp9. This is very important when it comes to quality, if you forget this your video is going to look bad at a CRF that would normally look good.</p></li>
<li><p><code>-pix_fmt yuv420p</code> set the colorspace to 4:2:0 which is important for wide player compatibility and hardware acceleration. This is essential when converting a series of images into a video since forgetting to set this leads to higher file sizes due to increased color representation capability and can make some players display the video incorrectly or to not play it at all.</p></li>
<li><p><code>-crf 30</code> sets the bitrate control mode to Constant Quality and the value to 30. In my experience this is a good value to start with. Lower values lead to higher quality. Try out different values to find out what works best for your content.</p></li>
<li><p><code>-cpu-used 1</code> sets the encoding speed, lower values equal better compression. 0 is the lowest speed and highest compression efficiency while 5 is the fastest speed and lowest compression efficiency.</p></li>
<li><p><code>-tile-columns 2</code> specifies that the video will use two tile columns. These are used to achieve multi-threaded encoding and depending on how old your version of FFmpeg is this might not be set automatically. 2 columns is suitable for 720p and 1080p video. Refer to <a href="https://developers.google.com/media/vp9/settings/vod/" rel="nofollow noreferrer">Google's VP9 encoding guide</a> for the suitable amount of tile columns and the amount of threads they allow you to use.</p></li>
<li><p><code>-threads 8</code> defines the amount of processing threads available for encoding. Set this to the amount of cores (or threads if you have HyperThreading/SMT available) on your CPU for the fastest encoding. This option still needs to be set manually even in latest versions of FFmpeg or else libvpx will only use one thread, which slows down encoding significantly.</p></li>
<li><p><code>-row-mt 1</code> enables better multithreading for libvpx. Setting this manually doesn't seem to be necessary in recent versions of FFmpeg but it doesn't hurt either.</p></li>
</ul>

CC BY-SA 4.0
2018-10-15T18:19:55.960Z
2018-10-15T18:19:55.960Z
veikk0
<p>You don’t declare a codec or quality. Try this:</p>

<pre><code>ffmpeg -f image2 -i img%05d.png -c:v libvpx -crf 10 -vf fps output3.webm
</code></pre>

<p>Reducing the 10 after crf should increase the quality. Also, “-vf fps”, I think defaults to 25 FPS. If you want something different, say 30 FPS, you would write it:</p>

<pre><code>-vf fps=“fps=30”
</code></pre>

CC BY-SA 4.0
2018-07-12T01:33:39.140Z
2018-07-12T10:07:35.010Z
2018-07-12T10:07:35.010Z
aclab28
<p>I made a .webm by compiling a series of rendered out images with FFMPEG. I'm intending for it to loop in background. The problem is, the first frame/frames (not sure) come out very blocky. I used this:</p>

<pre><code>ffmpeg -f image2 -i img%05d.png -vf fps output3.webm
</code></pre>

<p>anything I am missing to avoid this issue?</p>

<ffmpeg>
.webm blocky in initial frames, terrible for looping :(
WitherVoice
# .webm blocky in initial frames, terrible for looping :(

(Asked by: username_0 on 2018-07-10)

I made a .webm by compiling a series of rendered out images with FFMPEG. I'm intending for it to loop in background. The problem is, the first frame/frames (not sure) come out very blocky. I used this:
ffmpeg -f image2 -i img%05d.png -vf fps output3.webm

anything I am missing to avoid this issue?

**Tags:** ffmpeg


---

## 2 answers

### Answer by username_1 on 2018-10-15. Score: 1

Try something like this:

`ffmpeg -f image2 -framerate 30 -i img%05d.png -c:v libvpx-vp9 -b:v 0 -pix_fmt yuv420p -crf 30 -cpu-used 1 -tile-columns 2 -threads 8 -row-mt 1 output.webm`

* Placing `-framerate 30` before the input specifies it as the frame rate of the input to be 30. This is then inherited as the output frame rate as well.
* `-c:v libvpx-vp9` specifies that you want to use VP9. If you want to use VP8, use `-c:v libvpx` instead. VP8 has lower compression efficiency but is also less demanding to decode.
* `-b:v 0` is required for `-crf` to work the way most people expect when using libvpx or libvpx-vp9. This is very important when it comes to quality, if you forget this your video is going to look bad at a CRF that would normally look good.
* `-pix_fmt yuv420p` set the colorspace to 4:2:0 which is important for wide player compatibility and hardware acceleration. This is essential when converting a series of images into a video since forgetting to set this leads to higher file sizes due to increased color representation capability and can make some players display the video incorrectly or to not play it at all.
* `-crf 30` sets the bitrate control mode to Constant Quality and the value to 30. In my experience this is a good value to start with. Lower values lead to higher quality. Try out different values to find out what works best for your content.
* `-cpu-used 1` sets the encoding speed, lower values equal better compression. 0 is the lowest speed and highest compression efficiency while 5 is the fastest speed and lowest compression efficiency.
* `-tile-columns 2` specifies that the video will use two tile columns. These are used to achieve multi-threaded encoding and depending on how old your version of FFmpeg is this might not be set automatically. 2 columns is suitable for 720p and 1080p video. Refer to [Google's VP9 encoding guide](https://developers.google.com/media/vp9/settings/vod/) for the suitable amount of tile columns and the amount of threads they allow you to use.
* `-threads 8` defines the amount of processing threads available for encoding. Set this to the amount of cores (or threads if you have HyperThreading/SMT available) on your CPU for the fastest encoding. This option still needs to be set manually even in latest versions of FFmpeg or else libvpx will only use one thread, which slows down encoding significantly.
* `-row-mt 1` enables better multithreading for libvpx. Setting this manually doesn't seem to be necessary in recent versions of FFmpeg but it doesn't hurt either.


---

### Answer by username_2 on 2018-07-12. Score: 0

You don’t declare a codec or quality. Try this:
ffmpeg -f image2 -i img%05d.png -c:v libvpx -crf 10 -vf fps output3.webm

Reducing the 10 after crf should increase the quality. Also, “-vf fps”, I think defaults to 25 FPS. If you want something different, say 30 FPS, you would write it:
-vf fps=“fps=30”


---

