我正在製作一個需要將視頻轉換爲webm或mp4的應用程序,它適用於我嘗試過的所有視頻,但如果我在沒有音頻的情況下使用flv文件通道。使用ffmpeg編碼沒有音頻的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選項,它的工作原理,但我不能這樣做,因爲那樣的話所有的影片不會有音頻。
任何想法?
我不明白這個問題 - 你想轉碼文件有音頻嗎?此外,FFmpeg似乎聲稱您的示例中的FLV文件沒有音頻。 – 2012-04-14 15:31:10
如果原始文件有音頻,我希望轉碼後的文件具有音頻,並且如果原件沒有音頻,則不會發出錯誤。是的,示例中的FLV沒有音頻。 – 2012-04-14 16:09:30