ffmpeg更喜欢在VP9中编码,但我试图在VP8中进行编码

时间:2016-08-31 23:20:16

标签: ffmpeg webm vp8 libvpx vp9

我试图在VP8中专门编码webm视频文件,但ffmpeg正在强制使用VP9。我使用-c:v libvpx,据我所知,它应该是VP8,但是当它编码时,我会在VP9中看到它的编码:

ffmpeg -framerate 7 -loop 1 -i "C:\converted\cover.jpg" -c:v libvpx
-i "C:\converted\Image.wav" -b:v 50k -c:a libvorbis -b:a 96k
-vf scale=-1:300 -shortest -metadata title="%artist% - %album%" 
-metadata author="%artist%" -threads 8 -y "C:\converted\%artist% - %album%.webm"

ffmpeg version N-81489-ga37e6dd Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dx
va2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-lib
ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --ena
ble-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfree
type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enab
le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-lib
openh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschr
oedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheor
a --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvo
rbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --ena
ble-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --e
nable-decklink --enable-zlib
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 54.101 / 57. 54.101
  libavformat    57. 48.101 / 57. 48.101
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 57.100 /  6. 57.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from 'C:\converted\cover.jpg':
  Duration: 00:00:00.14, start: 0.000000, bitrate: 3159 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 500x495 [S
AR 1:1 DAR 100:99], 7 fps, 7 tbr, 7 tbn, 7 tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, wav, from 'C:\converted\Image.wav':
  Metadata:
    artist          : ???????
    genre           : Alternative Rock
    title           : goodnight, wonderend
    date            : 2014
  Duration: 00:04:48.00, bitrate: 1421 kb/s
    Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels,
 s16, 1411 kb/s
[swscaler @ 055f7d60] deprecated pixel format used, make sure you did set range
correctly
[libvpx-vp9 @ 0312d8e0] v1.6.0
[webm @ 0316e380] Using AVStream.codec to pass codec parameters to muxers is dep
recated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, webm, to 'C:\converted\カラスヤサボウ - goodnight, wonderend.w
ebm':
  Metadata:
    title           : カラスヤサボウ - goodnight, wonderend
    author          : カラスヤサボウ
    encoder         : Lavf57.48.101
    Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 303x300 [SAR 10000:9999 DAR 1
00:99], q=-1--1, 50 kb/s, 7 fps, 1k tbn, 7 tbc
    Metadata:
      encoder         : Lavc57.54.101 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp, 96 kb/s
    Metadata:
      encoder         : Lavc57.54.101 libvorbis
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> vp9 (libvpx-vp9))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
frame=   30 fps=0.0 q=0.0 size=      29kB time=00:00:00.71 bitrate= 333.4kbits/s
frame=   37 fps= 36 q=0.0 size=      49kB time=00:00:01.71 bitrate= 233.6kbits/s
frame=   45 fps= 27 q=0.0 size=      60kB time=00:00:02.85 bitrate= 170.6kbits/s
frame=   53 fps= 23 q=0.0 size=      84kB time=00:00:04.00 bitrate= 172.7kbits/s
frame=   57 fps= 21 q=0.0 size=     102kB time=00:00:04.57 bitrate= 183.5kbits/s
frame=   62 fps= 19 q=0.0 size=     112kB time=00:00:05.28 bitrate= 173.4kbits/s
frame=   64 fps= 12 q=0.0 Lsize=     141kB time=00:00:09.00 bitrate= 128.1kbits/
s speed=1.69x
video:87kB audio:47kB subtitle:0kB other streams:0kB global headers:4kB muxing o
verhead: 4.908199%
Exiting normally, received signal 2.

我的构建确实有--enable-libvpx--enable-libvpx-vp9个标志。它也是最新的默认静态构建,我没有做任何更改,只是提取它:ffmpeg-20160828-a37e6dd-win32-static.zip

我使用过时的构建很长一段时间并且今天更新了。我无法在线找到任何文档来帮助我解决这个问题。

2 个答案:

答案 0 :(得分:1)

选项放置很重要。您正在尝试将-c:v libvpx应用于Image.wav。移动此选项,使其位于输出名称之前。

答案 1 :(得分:1)

您应该在输出之前放置编解码器选项。

以下是一个简单的例子

$ ffmpeg -f lavfi -i testsrc2=d=5 -vcodec libvpx -f lavfi -i sine=d=5 -acodec libvorbis o.webm

上述命令仅选择-acodeclibvorbis,并使用默认视频编解码器。

以下命令会将视频编解码器选为libvpx,将音频编解码器选为libvorbis

$ ffmpeg -f lavfi -i testsrc2=d=5 -f lavfi -i sine=d=5 -vcodec libvpx -acodec libvorbis o.webm