14

I am trying to convert input.mp4 video to output.mkv using vp9 codec. I have install development version of ffmpeg via: brew install ffmpeg --devel.

ffmpeg -i input.mp4 -vcodec vp9 output.mkv

But I am getting error: Unknown encoder 'vp9' even the vp9 is included: ffmpeg -codecs

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Pavel Binar
  • 325
  • 2
  • 4
  • 11

2 Answers2

11

The most basic command is:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -c:a libopus output.webm

See FFmpeg Wiki: VP9 for more info.

llogan
  • 57,139
  • 15
  • 118
  • 145
  • Thanks, but command do not work. Here is the log: https://gist.github.com/pavelbinar/8236408 The problem probably is the fact that I do not have vp9 encoder installed/included (I thought that it in the ffmpeg 2.x) https://gist.github.com/pavelbinar/8236426 – Pavel Binar Jan 03 '14 at 11:23
  • I installed ffmpeg and all its components via this guide and it works now! https://sites.google.com/a/webmproject.org/wiki/ffmpeg/building-with-libvpx – Pavel Binar Jan 03 '14 at 12:22
  • How do I check if the input file has VP9 or some other codec? – Aaron Franke Dec 18 '21 at 18:01
3

With my version of ffmpeg,

$ ffmpeg -version
ffmpeg version 2.3.3 Copyright (c) 2000-2014 the FFmpeg developers

the command looks like this

ffmpeg -y -i input.mkv -c:v libvpx-vp9 -b:v 2000k -pass 1 -an -f webm /dev/null
ffmpeg    -i input.mkv -c:v libvpx-vp9 -b:v 2000k -pass 2 -c:a opus -b:a 64k -f webm output.webm

i.e.

  • leave out the experimental flags
  • do a two pass encoding, because the first two seconds of the output are blurry otherwise. Doing a two pass encoding is also faster than single pass.
  • when doing 2 pass, you do not need to encode the audio in the first pass as @FrankGalligan noted in a comment

Single pass is/was broken, according to http://wiki.webmproject.org/vp9/known-issues

user7610
  • 488
  • 4
  • 10
  • Do not set `-strict experimental`. That was for older FFmpeg. When doing 2 pass, you do not need to encode the audio in the first pass. `ffmpeg -y -i input.mkv -c:v libvpx-vp9 -b:v 2000k -pass 1 -an -f webm /dev/null` `ffmpeg -i input.mkv -c:v libvpx-vp9 -b:v 2000k -pass 2 -c:a opus -b:a 64k -f webm output.webm` – FrankGalligan Mar 03 '15 at 01:32
  • Its odd no one uses cq. What is your reason to use webm vs mkv? – Michael Mantion May 26 '22 at 16:01