我正在制作一个需要将视频转换为webm或mp4的应用程序,它适用于我尝试的所有视频,但如果我使用没有音频通道的flv文件则会失败。
$ ffmpeg -i 0986229665-339108519108-86498841039-6078455325.flv out.webm
ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers
built on Jan 4 2012 16:08:51 with gcc 4.6.1
configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
WARNING: library configuration mismatch
avutil configuration: --extra-version='4:0.7.3ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
avcodec configuration: --extra-version='4:0.7.3ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
libavutil 51. 7. 0 / 51. 7. 0
libavcodec 53. 6. 0 / 53. 6. 0
libavformat 53. 3. 0 / 53. 3. 0
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 4. 0 / 2. 4. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 52. 0. 0 / 52. 0. 0
[flv @ 0x2184560] Could not find codec parameters (Audio: [0][0][0][0] / 0x0000, 0 channels)
[flv @ 0x2184560] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from '0986229665-339108519108-86498841039-6078455325.flv':
Metadata:
audiocodecid : -1
server : Red5 Server 1.0.0 RC1 $Rev: 4193 $
duration : 3
canSeekToEnd : true
videocodecid : 2
Duration: 00:00:03.02, start: 0.000000, bitrate: N/A
Stream #0.0: Video: flv, yuv420p, 640x362, 1k tbr, 1k tbn, 1k tbc
Stream #0.1: Audio: [0][0][0][0] / 0x0000, 0 channels
Incompatible sample format '(null)' for codec 'libvorbis', auto-selecting format 's16'
[buffer @ 0x21852c0] w:640 h:362 pixfmt:yuv420p
[libvpx @ 0x2184040] v0.9.6
[libvorbis @ 0x2185ee0] oggvorbis_encode_init: init_encoder failed
Output #0, webm, to 'out.webm':
Stream #0.0: Video: libvpx, yuv420p, 640x362, q=2-31, 200 kb/s, 90k tbn, 1k tbc
Stream #0.1: Audio: libvorbis, 0 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height
如果我传递-an选项,它可以工作,但我不能这样做,因为那时所有视频都没有音频。
有什么想法吗?
答案 0 :(得分:1)
这非常不寻常。如果源文件没有音频流,则FFmpeg不应该尝试转码音频流。
你从哪里获得这个版本的FFmpeg?你自己编译了吗?该版本看起来有点过时了。输出中的这一行并不适合我:
WARNING: library configuration mismatch
此外,这些FLV文件可能有些奇怪(如果元数据正确,则由Red5输出)。由于某种原因,也许有一个NULL音频标签。您能够将一小部分样本用于研究吗?