0

sorry for my english...

On my hosting - ffmpeg is installed as a php module. I'm having errors when converting video to mp4 format

Error:

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

Example of the ffmpeg command:

/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

I run this command through the php exec() function in the script:

exec ($command, $res);

And here is the result that I get ($res array):

Array ( [0] => ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers [1] => built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16) [2] => 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] => libavutil 54. 20.100 / 54. 20.100 [4] => libavcodec 56. 26.100 / 56. 26.100 [5] => libavformat 56. 25.101 / 56. 25.101 [6] => libavdevice 56. 4.100 / 56. 4.100 [7] => libavfilter 5. 11.102 / 5. 11.102 [8] => libavresample 2. 1. 0 / 2. 1. 0 [9] => libswscale 3. 1.101 / 3. 1.101 [10] => libswresample 1. 1.100 / 1. 1.100 [11] => libpostproc 53. 3.100 / 53. 3.100 [12] => Input #0, flv, from '/home/afk/public_html/webroot/files/video.flv': [13] => Metadata: [14] => title : Title of the video [15] => encoder : Lavf56.25.101 [16] => Duration: 00:00:24.00, start: 0.000000, bitrate: 1364 kb/s [17] => Stream #0:0: Video: flv1, yuv420p, 500x500, 200 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc [18] => [libx264 @ 0x1ec6720] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [19] => Output #0, mp4, to '/home/afk/public_html/webroot/files/video_text.mp4': [20] => Metadata: [21] => title : Title of the video [22] => encoder : Lavf56.25.101 [23] => Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, 25 fps [24] => Metadata: [25] => encoder : Lavc56.26.100 libx264 [26] => Stream mapping: [27] => Stream #0:0 -> #0:0 (flv1 (flv) -> h264 (libx264)) [28] => Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height )

The same error occurs when converting any video into this format. I've already used the examples from the ffmpeg documentation, but the error remains. Help to understand and solve this problem.

At the same time, the conversion from flv to ogg format works normally, or the creation of video from images into flv and ogg formats

  • Upgrade ffmpeg and check. – Gyan Jul 17 '18 at 05:09
  • I can not do it. Because my hosting provider allows me to select only the version of php. And in all versions of php, only this version of ffmpeg is available. – user4215048 Jul 17 '18 at 05:29
  • You may not need to rely on your hosting provider to get a newer version. Just [download](https://johnvansickle.com/ffmpeg/) a static build and [make your script use the new version](https://stackoverflow.com/questions/39884653/how-to-install-ffmpeg-for-php). – llogan Jul 17 '18 at 19:46
  • I downloaded the static version. Now the conversion from mp4 format to flv takes place without errors. But for example, the command ffmpeg -loop 1 -i img.jpg -c: v libx264 -t 30 -pix_fmt yuv420p out.mp4 still produces an error: Error initializing output stream 0: 0 - Error while opening encoder for output stream # 0 : 0 - maybe incorrect parameters such as bit_rate, rate, width or height – user4215048 Jul 18 '18 at 18:04

0 Answers0