[FFmpeg-user] AVI, WMV, FLV, MOV and MP4 to libx264 MP4 conversion bugs

Lou lou at lrcd.com
Fri Jan 4 21:01:20 CET 2013

On Sat, 5 Jan 2013 00:53:21 +0530
Teshan Nanayakkara <teshan87 at gmail.com> wrote:

> Hi there,
> I have used the following command line expression to compress and convert
> AVI, WMV, FLV, MOV and MP4 files to libx264 MP4.
> *ffmpeg -i abc.flv -vcodec libx264 -vf scale=-1:360 -qscale 7 -acodec
> libvo_aacenc -ab 32 -ar 24000 abc.mp4*
> To run this command I use PHP exec() function. I need to know the most
> appropriate and the correct commands to convert each and every (above
> mentioned) format to H.264 MP4 format without changing the aspect ratio and
> video height less than or equal to 360 pixels. And with aac audio encoding
> codec. Sometimes ffmpeg fails to convert above formats but not always. It
> may be depending on the source file's codecs. So I need to know how the
> above command should be modified to convert each video format mentioned
> above.
> Thanks

The complete console outputs are missing. Without the ffmpeg commands
and console outputs we can only make guesses since "fails to convert"
is not as descriptive as any actual ffmpeg messages or errors.

You should first run the ffmpeg commands manually, that is outside of
PHP, until you get a satisfactory result.

Some other stuff:

* libvo_aacenc isn't a great AAC encoder.

* libx264 probably ignores qscale resulting in the default of "-crf
  24". This usually provides a decent output buy maybe not what you

* "-ab" takes a value in bits, not kilobits, so use "-ab 32k".

* "-ar 24000" seems unnecessary.

* If the resulting width is an odd value then libx264 will complain
  with "height not divisible by 2". scale="trunc(oh*a*2)/2:360" should
  automatically round down to an even value if odd.

More information about the ffmpeg-user mailing list