convert from avi to mp4 using ffmpeg

15,416

Solution 1

Old, but this post comes up tops in searches so...

ffmpeg should easily convert from avi to mp4 without re-encoding. (Do not specify new codecs!)

ffmpeg -i input.avi -c:v copy -c:a copy OUTPUT.mp4

Should also mention that batch conversions run most reliably when the script contains static data with each ffmpeg call on a new line (as opposed to having the script generate each call dynamically using variables).

Solution 2

I would suggest you use the latest version of ffmpeg. You don't need to download extra dlls.

Use libvo_aacenc instead of libfaac

-crf 22 is high use lower say -crf 19

As far my experience I would use

ffmpeg -i input.avi -c:v libx264 -preset slow -crf 19 -c:a libvo_aacenc -b:a 128k

Solution 3

code to avi to mp4.ffmpeg provides the best solution

ffmpeg -i input.avi -strict -2 output.mp4
Share:
15,416

Related videos on Youtube

user3217695
Author by

user3217695

Updated on June 04, 2022

Comments

  • user3217695
    user3217695 almost 2 years

    I want to play an avi video format file in browsers using HTML5 video code. Since the avi format file doesn't play in browsers i have to convert it into mp4 format file.

    For conversion i am using the ffmpeg code in Windows.

    ffmpeg -i input.avi OUTPUT.mp4

    The conversion of video is completed but the video codec and audio codec isn't valid thus it fails to play to play using video tag in html5.

    Please find me proper code which coverts the file. another conversion code i tried was.. ffmpeg -i input.avi -c:v libx264 -preset slow -crf 22 -c:a libfaac -b:a 128k OUTPUTAVINew.mp4 but i got error as libfaac unknown encoder please help me out and even i downloaded the **libfaac.dll** but didn't work out `

    • enhzflep
      enhzflep over 10 years
      Find a video that does work, then encode your videos with the same codecs, simples. To get info, use the following cmd ffmpeg -i mymovie.avi, where mymovie.avi is replaced with the name of your video.
  • llogan
    llogan about 5 years
    The question asker already tried that (besides properly omitting the unneeded -strict -2). What does your answer do any differently?