.avi文件到具有alpha通道的.web文件



我不知道如何使用FFmpeg,但我的.avi文件对于2秒的视频来说太大了?知道我如何将其转换为WebM吗?同时保留其alpha通道?

我试过这个:

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

输出显示:

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!

最简单的命令是:

ffmpeg -i input.avi output.webm
  • 默认情况下将使用视频编码器libvpx-vp9
  • libvpx-vp9支持alpha,因此默认情况下将保留alpha
  • 有关更多信息,请参阅FFmpeg Wiki:VP9

我用来解决的命令:

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

注意文件名:

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

简单命令:

ffmpeg -i input.avi output.webm

相关内容

  • 没有找到相关文章