尝试将视频从flash录像机转换为mp4时出现错误:
ubuntu@media:/data/media/failed$ avconv -i videoStream_1356794393712_805.flv -acodec aac videoStream_1356794393712_805.mp4
avconv version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
built on Nov 6 2012 16:51:33 with gcc 4.6.3
[libspeex @ 0x1091500] Missing Speex header, assuming defaults.
[flv @ 0x108d7a0] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'videoStream_1356794393712_805.flv':
Metadata:
creationdate : Sat Dec 29 15:20:12
Duration: 00:00:04.39, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264 (Main), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 30 tbr, 1k tbn, 60 tbc
Stream #0.1: Audio: libspeex, 16000 Hz, 1 channels, s16
[buffer @ 0x1093a00] w:640 h:480 pixfmt:yuv420p
[mpeg4 @ 0x1094ce0] removing common factors from framerate
[aac @ 0x108d120] Too many bits per frame requested
Output #0, mp4, to 'videoStream_1356794393712_805.mp4':
Metadata:
creationdate : Sat Dec 29 15:20:12
Stream #0.0: Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 30 tbc
Stream #0.1: Audio: aac, 16000 Hz, 1 channels, s16, 200 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> mpeg4)
Stream #0:1 -> #0:1 (libspeex -> aac)
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
ubuntu@media:/data/media/failed$
Ubuntu 12.04 LTS,默认ffmpeg/avconv.
我该如何解决这个问题?
ffprobe日志:
ubuntu@media:/data/media/failed$ ffprobe videoStream_1356794393712_805.flv
avprobe version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2007-2012 the Libav developers
built on Nov 6 2012 16:51:33 with gcc 4.6.3
[libspeex @ 0x1c27500] Missing Speex header, assuming defaults.
[flv @ 0x1c237a0] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'videoStream_1356794393712_805.flv':
Metadata:
creationdate : Sat Dec 29 15:20:12
Duration: 00:00:04.39, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264 (Main), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 30 tbr, 1k tbn, 60 tbc
Stream #0.1: Audio: libspeex, 16000 Hz, 1 channels, s16
[libspeex @ 0x1c27500] Missing Speex header, assuming defaults.
ubuntu@media:/data/media/failed$
我找到了解决方案。需要安装这些软件包:sudo apt-get install libavcodec-extra-53 libavdevice-extra-53 libavfilter-extra-2 libavformat-extra-53 libavutil-extra-51 libpostproc-extra-52 libswscale-extra-2
我找到了另一个解决方案。Ffmpeg必须以二进制版本(linux x64)从官方网站的链接下载。
Ubuntu版本有编解码器问题
我在Ubuntu 14.04中通过使用libvo_aacenc编解码器而不是aac编解码器解决了这个问题。您可以将命令修改为如下所示:
avconv -i videoStream_1356794393712_805.flv -c:v mpeg4 -c:a libvo_aacenc videoStream_1356794393712_805.mp4