Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: FFmpeg WebM / VP8 / libvpx parameters?

  1. #1
    Join Date
    Jun 2007
    Location
    Australia, Victoria
    Beans
    144
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    FFmpeg WebM / VP8 / libvpx parameters?

    I've started playing around with using VP8 video encoding via FFmpeg and libvpx. I wanted to see if it was as good as libx264, but I'm struggling to find how to use it properly.
    For libx264 there are a bunch of options and presets available, but I don't know what they are for libvpx.
    Are there any "-vpre" things for libvpx?
    What should I do to get a good output?
    The WebM page gives a bunch of sample commands, but they don't work with FFmpeg (I think because the commands are for ivfenc, whatever that is).

    Any ideas?
    How can I produce a good quality WebM / VP8 coded video with FFmpeg? (Or just with Ubuntu in general, doesn't have to FFmpeg).

  2. #2
    Join Date
    Mar 2009
    Location
    Santa Clara CA
    Beans
    4
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: FFmpeg WebM / VP8 / libvpx parameters?

    I have been using the following command to encode videos, and it produces excellent quality:

    Code:
    ffmpeg -y -i <INPUT_FILE> -threads 8 -f webm -aspect 16:9 -vcodec libvpx -deinterlace -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -rc_buf_aggressivity 0.95 -vb 2M -acodec libvorbis -aq 90 -ac 2 <OUTPUT_FILE.webm>
    Notes:
    • I got most of the parameters from the preset files available in the google patches. However, some of them did not work with the native FFMPEG vp8 encoder as of the latest SVN build.
    • The deinterlace parameter can be removed if the video is not interlaced.
    • The aspect parameter forces 16:9, change it to 4:3 if you have standard def video.
    • The -aq parameter can safely be lowered to 60 or 70, but I am picky about having high quality audio.
    • The -threads parameter should be lowered to the max available threads that your cpu can handle. I use a core i7 so the max treads are 8.

  3. #3
    Join Date
    Sep 2006
    Beans
    3,713

    Re: FFmpeg WebM / VP8 / libvpx parameters?

    Quote Originally Posted by demizer View Post
    However, some of them did not work with the native FFMPEG vp8 encoder as of the latest SVN build.
    There is no native FFmpeg VP8 encoder yet, but there is a native VP8 decoder though.

    Quote Originally Posted by demizer View Post
    [*]The -aq parameter can safely be lowered to 60 or 70, but I am picky about having high quality audio.
    I believe the -aq range for libvorbis via FFmpeg for stereo is -1 to 10. Anything above 10 probably ends up about the same as what 10 would provide. See Recommended Vorbis Encoder Settings for a nice chart of each quality level.
    Last edited by FakeOutdoorsman; July 2nd, 2010 at 09:52 PM.

  4. #4
    Join Date
    Jun 2007
    Location
    Australia, Victoria
    Beans
    144
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: FFmpeg WebM / VP8 / libvpx parameters?

    Thanks for this.

    What do the "-g" and "-level" settings do? Where can I find the presets on the WebM site? Some of the options mentioned look interesting. What about 2-pass encoding? Can I just specify "-pass 1" and put the video to "/dev/null" and then "-pass 2" after that? (Like with x264).
    Come to think of it, is there some sort of command I can pass to FFmpeg to have it tell me all of the acceptable arguments for the libvpx encoder? It must list them somewhere, because it obviously knows when you use one it doesn't recognise...



    Also, about the Vorbis audio, I knew that it went from -1 to 10, but in some programs, such as SuondKonverter, the levels seem to be multiplied by 10, to go from 0 to 100, and I think it's then possible to specify, say, 85 which I think means 8.5 on the proper scale. Maybe FFmpeg does this?


    Also, can I safely use an .mkv container? So far my computer doesn't know what to do with a .webm file (not hard to fix, but still) but it can play the VP8 codec. Is Matroska going to widely support VP8 in the future? Or should I just use the .webm container to avoid confusion?

  5. #5
    Join Date
    Dec 2006
    Beans
    7,349

    Re: FFmpeg WebM / VP8 / libvpx parameters?

    Hi sean,

    Quote Originally Posted by seanlano View Post
    Also, can I safely use an .mkv container? So far my computer doesn't know what to do with a .webm file (not hard to fix, but still) but it can play the VP8 codec. Is Matroska going to widely support VP8 in the future? Or should I just use the .webm container to avoid confusion?
    Bear in mind that a WebM container is actually a pared down Matroska container anyway, some interesting reading here which demonstrates that mkvtoolnix accepts WebM as an input and also output. Courtesy of the work I do packaging mkvtoolnix for another distro I have the latest copy at hand and I can confirm it works beautifully. The attached screenshots shows WebM input being converted to full mkv output which MPlayer plays with no problem... The 3rd screenshot shows the option to create an output file with WebM constraints.

    All the best,

    Andrew
    Attached Images Attached Images
    Last edited by andrew.46; July 3rd, 2010 at 10:16 AM.
    You think that's air you're breathing now?

  6. #6
    Join Date
    Nov 2009
    Beans
    6

    Re: FFmpeg WebM / VP8 / libvpx parameters?

    I tried to make a .ffpreset file based on demizer's post. It looks like this:

    Code:
    g 120
    level 216
    profile 0
    qmax 42
    qmin 10
    rc_buf_aggressivity 0.95
    vb 2M
    ffmpeg found the file, but did not like a single one of the arguments. However, when I put them directly into the command line they worked OK.

    I hope they get this sorted soon. I really like using the presets for libx264.

    geo.

  7. #7
    Join Date
    Sep 2006
    Beans
    3,713

    Re: FFmpeg WebM / VP8 / libvpx parameters?

    Quote Originally Posted by geo.cohn View Post
    I tried to make a .ffpreset file based on demizer's post. It looks like this:

    Code:
    g 120
    level 216
    profile 0
    qmax 42
    qmin 10
    rc_buf_aggressivity 0.95
    vb 2M
    ffmpeg found the file, but did not like a single one of the arguments. However, when I put them directly into the command line they worked OK.

    I hope they get this sorted soon. I really like using the presets for libx264.

    geo.
    You need to add = between the option and value for presets:
    Code:
    g=120
    level=216
    profile=0
    qmax=42
    qmin=10
    rc_buf_aggressivity=0.95
    vb=2M
    Not all options are available for use in the presets.

  8. #8
    Join Date
    Jun 2010
    Location
    Revere, MA
    Beans
    10
    Distro
    Ubuntu 10.04 Lucid Lynx

    Post Re: FFmpeg WebM / VP8 / libvpx parameters?

    I believe the -aq range for libvorbis via FFmpeg for stereo is -1 to 10. Anything above 10 probably ends up about the same as what 10 would provide. See Recommended Vorbis Encoder Settings for a nice chart of each quality level.
    I am the co-author of that wiki page. You providing me with valuable information. Let me scrim through the manual and see what I can cook up. I will document how to do it in ffmpeg I think your on the right track though with audio in standalone encoder -q 5 more then likely maps to -aq 50 in ffmpeg!. I just did a quick test with a MPEG-2 TS file from a DVD and ivfenc encodes the file quite nicely. The thing that I don't like about the video encoder is that it does specify how to encode audio via Vorbis with the standalone encoder!? What's that all about !?. Let me do some digging and I will see what I can find. We can at least show folks how to do it with ffmpeg in the meantime. I think maybe --codec switch in ivfenc has something to do specify the audio, but Google did a VERY POOR job documenting it besides the --good and --best quality switches. The i420 is regular MPEG2 stream btw. It's stands for interlaced 420.
    Last edited by HotshotGG; July 14th, 2010 at 11:03 PM.

  9. #9
    Join Date
    May 2005
    Beans
    148
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: FFmpeg WebM / VP8 / libvpx parameters?

    The ffmpeg command didn't seem to work for me. Obviously, I need to do more setup and prep for the libvpx. What do you do to set this up? I just got the following error

    Code:
    Requested output format 'webm' is not a suitable output format

  10. #10
    Join Date
    Dec 2006
    Beans
    7,349

    Re: FFmpeg WebM / VP8 / libvpx parameters?

    Hi mike,

    Quote Originally Posted by mike4ubuntu View Post
    The ffmpeg command didn't seem to work for me. Obviously, I need to do more setup and prep for the libvpx. What do you do to set this up?
    The best way is to follow this guide:

    HOWTO: Install and use the latest FFmpeg and x264
    http://ubuntuforums.org/showthread.php?t=786095

    and add in the optional libvpx step. You may find that x264 encoding still delivers better quality faster, that is certainly my experience...

    Andrew
    You think that's air you're breathing now?

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •