duanjiao4763 2018-07-16 20:10
浏览 3088

ffmpeg:将视频保存或转换为.mp4格式时出错

在我的托管服务器上,ffmpeg 是作为 php 模块安装的。我在将视频转换为 mp4格式时出错:

Error while opening the encoder for output stream # 0: 0 - maybe incorrect parameters such as bit_rate, rate, width or height

Ffmpeg 命令示例:

/usr/bin/ffmpeg -y -i /home/afk/public_html/webroot/files/video.flv -vcodec libx264 -acodec libvo_aacenc /home/afk/public_html/webroot/files/video_text.mp4 2 <& 1

我通过脚本中的 php exec ()函数运行这个命令:

<p>exec ($command, $res);</p>

<p>And here is the result that I get ($res array):</p>
<p>Array ( [0] =&gt; ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers [1] =&gt; built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16) [2] =&gt; configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libdc1394 --enable-libfaac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect [3] =&gt; libavutil 54. 20.100 / 54. 20.100 [4] =&gt; libavcodec 56. 26.100 / 56. 26.100 [5] =&gt; libavformat 56. 25.101 / 56. 25.101 [6] =&gt; libavdevice 56. 4.100 / 56. 4.100 [7] =&gt; libavfilter 5. 11.102 / 5. 11.102 [8] =&gt; libavresample 2. 1. 0 / 2. 1. 0 [9] =&gt; libswscale 3. 1.101 / 3. 1.101 [10] =&gt; libswresample 1. 1.100 / 1. 1.100 [11] =&gt; libpostproc 53. 3.100 / 53. 3.100 [12] =&gt; Input #0, flv, from '/home/afk/public_html/webroot/files/video.flv': [13] =&gt; Metadata: [14] =&gt; title : Title of the video [15] =&gt; encoder : Lavf56.25.101 [16] =&gt; Duration: 00:00:24.00, start: 0.000000, bitrate: 1364 kb/s [17] =&gt; Stream #0:0: Video: flv1, yuv420p, 500x500, 200 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc [18] =&gt; [libx264 @ 0x1ec6720] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [19] =&gt; Output #0, mp4, to '/home/afk/public_html/webroot/files/video_text.mp4': [20] =&gt; Metadata: [21] =&gt; title : Title of the video [22] =&gt; encoder : Lavf56.25.101 [23] =&gt; Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, 25 fps [24] =&gt; Metadata: [25] =&gt; encoder : Lavc56.26.100 libx264 [26] =&gt; Stream mapping: [27] =&gt; Stream #0:0 -&gt; #0:0 (flv1 (flv) -&gt; h264 (libx264)) [28] =&gt; Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height )</p>

将任何视频转换为此格式时都会发生同样的错误。我已经使用了 ffmpeg 文档中的示例,但仍然存在错误。请帮助理解和解决这个问题。

同时,从 flv 到 ogg 格式的转换工作正常,或者从图像到 flv 和 ogg 格式的视频创建。

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题
    • ¥15 Python时间序列如何拟合疏系数模型