命令看起来很简单,比如
将一个文件转换为flv文件,命令如下:
ffmpeg -isrc.wmv -y output.flv
出现error错误:
[adpcm_swf @0x2104a20]Sample rate must be 11025, 22050 or44100
Error while opening codecfor output stream #0.1 - maybe incorrect parameters such asbit_rate, rate, width or height
这里需要加一个参数
ffmpeg -i src.wmv -ar 11025output.flv
我是从下面文章中获得了答案,由于对视频的一些知识不是很懂,暂时只能照葫芦画瓢
内容如下:
- First I tried this:
ffmpeg -i input.avi output.flv
and got this error:Input #0, avi, from 'input.avi':
Duration: 00:00:27.8, start: 0.000000, bitrate: 4128 kb/s
Stream #0.0: Video: mjpeg, yuvj422p, 640x480 [PAR 0:1 DAR 0:1], 15.00 tb(r)
Stream #0.1: Audio: pcm_s16le, 7875 Hz, mono, 126 kb/s
Output #0, flv, to 'output.flv':
Stream #0.0: Video: flv, yuv420p, 640x480 [PAR 0:1 DAR 0:1], q=2-31, 200 kb/s, 15.00 tb(c)
Stream #0.1: Audio: adpcm_swf, 7875 Hz, mono, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
[adpcm_swf @ 0x7f0f3be6ba00]Sample rate must be 11025, 22050 or 44100
Error while opening codec for output stream #0.1 - maybe incorrect parameters such
as bit_rate, rate, width or height - Then I tried this:
ffmpeg -i input.avi -vcodec copy -acodec pcm_s16le output.flv
and got this error:[pcm_s16le @ 0x7f058dfcba00]flv does not support that sample rate, choose from (44100, 22050, 11025).
Could not write header for output file #0 (incorrect codec parameters ?) - Then i tried this
ffmpeg -i input.avi -vcodec copy -acodec pcm_s16le -ar 44100 output.flv
and only got audio, no video in output file. - Then this:
ffmpeg -i input.avi -ar 44100 output.flv
and finally got something that works, however the quality wasn'tgreat. - To increase quality, use the -sameq argument (same quality assource) This doubled the file size but the flv was much higherquality.
ffmpeg -i input.avi -sameq -ar 44100 output.flv