0

FFmpeg failed to transcode dsmall.mp4. Reported errors

PHPVideoToolkit error: Execute error. It was not possible to encode "/var/www/vhosts/imodb.ir/cinemagram.ir/sites/default/files/videos/original/dsmall_5.mp4" as FFmpeg returned an error. The error is with the video codec of the input file. FFmpeg reports the error to be "Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height".

Executed commands and output

/usr/local/bin/ffmpeg -i '/var/www/vhosts/imodb.ir/cinemagram.ir/sites/default/files/videos/original/dsmall_5.mp4' -vf 'scale=498:360' -strict experimental -vcodec 'libx264' -acodec 'alac' -ac '2' -pass '1' -passlogfile '/tmp/1408770806-53f822f6bbf29-multipass'  -y /tmp/1408770806-53f822f6bbe41.mp4

FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug 14 2014 22:54:14 with gcc 4.4.7 20120313 (Red Hat 4.4.7-4)
  configuration: --enable-libfaac --enable-shared --enable-memalign-hack --enable-gpl --enable-libtheora --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-avfilter --enable-swscale
  libavutil     50.36. 0 / 50.36. 0
  libavcore      0.16. 1 /  0.16. 1
  libavcodec    52.108. 0 / 52.108. 0
  libavformat   52.93. 0 / 52.93. 0
  libavdevice   52. 2. 3 / 52. 2. 3
  libavfilter    1.74. 0 /  1.74. 0
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/vhosts/imodb.ir/cinemagram.ir/sites/default/files/videos/original/dsmall_5.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2010-03-20 21:29:11
    encoder         : HandBrake 0.9.4 2009112300
  Duration: 00:00:05.56, start: 0.000000, bitrate: 551 kb/s
    Stream #0.0(und): Video: h264, yuv420p, 560x320, 465 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Metadata:
      creation_time   : 2010-03-20 21:29:11
    Stream #0.1(eng): Audio: aac, 48000 Hz, mono, s16, 83 kb/s
    Metadata:
      creation_time   : 2010-03-20 21:29:11
[buffer @ 0xb13d80] w:560 h:320 pixfmt:yuv420p
[scale @ 0xb142f0] w:560 h:320 fmt:yuv420p -> w:498 h:360 fmt:yuv420p flags:0xa0000004
[libx264 @ 0xa62cd0] broken ffmpeg default settings detected
[libx264 @ 0xa62cd0] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0xa62cd0] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0xa62cd0] speed presets are listed in x264 --help
[libx264 @ 0xa62cd0] profile is optional; x264 defaults to high
Output #0, mp4, to '/tmp/1408770806-53f822f6bbe41.mp4':
    Stream #0.0(und): Video: libx264, yuv420p, 498x360, q=2-31, pass 1, 200 kb/s, 90k tbn, 30 tbc
    Metadata:
      creation_time   : 2010-03-20 21:29:11
    Stream #0.1(eng): Audio: alac, 48000 Hz, 2 channels, s16, 64 kb/s
    Metadata:
      creation_time   : 2010-03-20 21:29:11
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height

update we install new version of ffmpeg with below properties

ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 13 2014 13:00:18 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandi
r=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enabl
e-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11gra
b --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-
libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenco
re-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enab
le-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx2
64 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_F
ORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -m
tune=generic -fPIC' --disable-stripping
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

I want to convert every video to mp4 , what is good preset for my goal ?

4

I'm pretty sure the error is that your original video only has mono audio whereas you're requesting two channels for output.

But then again, you're using a terribly outdated version of ffmpeg. It's so ancient that the FFmpeg project doesn't even use SVN anymore – that was 2011. The old version might have bugs that prevent it from running the command.

You should download a newer one (one of the static builds) and use that instead, or even compile it yourself. Newer versions have thousands of bugs fixed, have more sensible default behavior and give you more meaningful errors if something happens.

Since you seem to be using PHPVideoToolkit, which is also outdated, consider switching to phpvideotoolkit-v2 which at least supports ffmpeg 1.2. Current ffmpeg is 2.3 though. Or you use PHP-FFMpeg, which also seems to be actively developed.


Regarding your command line, I presume you don't want alac as audio codec, but aac. ALAC is Apple's Lossless Audio Codec, whereas for H.264 video you typically want AAC audio. Change it to -acodec aac (or with newer syntax, -c:a aac). This is something the PHP frameworks will do for you automatically if you choose the right settings, of course.

  • Is that mean old version ?FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers built on Aug 14 2014 22:54:14 with gcc 4.4.7 20120313 (Red Hat 4.4.7-4) ? – Yusef Mohamadi Aug 23 '14 at 12:44
  • See the "Copyright 2011"? That version was released more than three years ago. – slhck Aug 23 '14 at 12:47
  • you right, thank you very much, I try you solution – Yusef Mohamadi Aug 23 '14 at 13:09
  • @zhilevan I just checked again.. I'm pretty sure you don't want alac as audio codec, but aac. Is that correct? ALAC is Apple's Lossless Audio Codec, whereas for H.264 video you typically want AAC audio. – slhck Aug 24 '14 at 7:36
  • tnx for you attention, I update my question, please update your anwer , tnx – Yusef Mohamadi Aug 26 '14 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.