I am trying to convert a .avi file into a .mp4 one using FFMPEG using the libx264 codec.

This is the command I am running:

ffmpeg -i filename.avi -c:v libx264 -crf 19 -strict experimental filenameAvi.mp4 

I sometimes get the following error:

[libx264 @ 0x85b460] height not divisible by 2 (176x99)

I used the following answer:


and modified the command accordingly as follows:

ffmpeg -i filename.avi -c:v libx264 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -crf 19 -strict experimental filenameAvi.mp4 

For the same file what now happens is it hangs up after a couple of frames. I have not much idea about ffmpeg, kindly suggest how to solve this. Fscreenshot

  • Upgrade to 4.0 and check. – Gyan Jul 3 '18 at 12:14
  • i am unable to find a suitable link for upgrading ffmpeg to 4.0 on ubuntu 16.04, could you please point one? – Chandan Kumar Jul 3 '18 at 13:37
  • Get a static build from ffmpeg.org/download.html – Gyan Jul 3 '18 at 13:42
  • Hi, sorry for replying late. After upgrading to 4.0 it is working fine.Thanks a lot :) – Chandan Kumar Jul 4 '18 at 7:15

I do have same problem.

Step1: change resolution of your .avi file

ffmpeg -i filename.avi -vf "scale=176:98" filename1.avi

Step2: convert .avi to .mp4

ffmpeg -i filename1.avi filename.mp4

That works for me

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.