I'm making an application that needs to convert videos to webm or mp4, it works great with all videos I've tried, but it fails if I use a flv file with no audio channels.
$ 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
If I pass the -an option, it works, but I can't do that because then all videos wouldn't have audio.
Any ideas?
This is extremely unusual. If the source file has no audio stream, then FFmpeg is not supposed to attempt to transcode an audio stream.
Where did you obtain this version of FFmpeg from? Did you compile it yourself? The version looks a bit out of date. And this line from the output does not sit well with me:
WARNING: library configuration mismatch
Also, it's possible that there is something weird about those FLV files (output by Red5, if the metadata is correct). Perhaps there is a NULL audio tag for some reason. Would you be able to make a small sample available for study?