ffmpegalphawebmavi

.avi file to .webm file with alpha channel


I have no idea how to use FFmpeg, but my .avi file is too large for a 2-second video? Any idea how I can convert it to WebM? While retaining its alpha channel?

I tried this:

ffmpeg -i "1.avi" -c:v libvpx -pix_fmt yuva420p "1.webm"

Output showed:

ffmpeg version 4.4-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[avi @ 00000245f2e7d640] Stream #0: not enough frames to estimate rate; consider increasing probesize
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from '1.avi':
  Duration: 00:00:02.00, start: 0.000000, bitrate: 3983150 kb/s
  Stream #0:0: Video: rawvideo, bgra, 1920x1080, 4014784 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
  Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> vp8 (libvpx))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libvpx @ 00000245f2e8ecc0] v1.10.0-24-g8b3e575a4
[libvpx @ 00000245f2e8ecc0] Neither bitrate nor constrained quality specified, using default CRF of 32 and bitrate of 256kbit/sec
[libvpx @ 00000245f2e8ecc0] Transparency encoding with auto_alt_ref does not work
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

Solution

  • Command I used to solve:

    ffmpeg -i "1.avi" -c:v libvpx -b:v 2000k -pix_fmt yuva420p -auto-alt-ref 0 "1.webm"
    

    Note filenames:

    "1.avi" - input.avi
    "1.webm" - out.webm
    

    Simple command:

    ffmpeg -i input.avi output.webm