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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?
    • ¥100 求三轴之间相互配合画圆以及直线的算法