Compared with AVI, MP4 has better compatibility which is supported by almost all the media players, devices, and operating systems. Sometimes, you need to convert AVI to MP4 because of the compatibility. FFmpeg is an open-source software project that includes a suite of libraries and programs for handling videos, audio, and other multimedia files. You can use FFmpeg to convert AVI to MP4. In the below content, we will present you with detailed steps to convert AVI to MP4. Let’s get started.
How to Convert AVI to MP4 with FFmpeg
Read this part to master how to use FFmpeg to convert AVI to MP4. Below are detailed steps:
Step 1. Download and install FFmpeg
You need to install FFmpeg first. For detailed steps to install FFmpeg on your Windows or Mac PC, you can read this post: How to Download and Install FFmpeg on Windows/Mac/Linux
Step 2. Open the Command Prompt
You can press Win + R to open the Run box, Type “cmd” into the box, and press Enter to access the Command Prompt. Alternatively, you can search for “cmd” or “command prompt” in the Start Search box of Windows, find the right one, and click Open.
Step 3. Specify the directory for the target AVI file
Open the folder that stores the target AVI file and copy the address of the folder. Back to the Command Prompt, enter “cd”, press the Space key to leave a space, and then press Enter to process to the next step.
Step 4. Enter the command for the FFmpeg AVI to MP4 conversion
Below are 4 example commands you can use:
- ffmpeg -i input.avi -c:v libx264 -c:a aac output.mp4
- ffmpeg -i input.avi -c:v libx264 -preset slow -crf 19 -c:a aac -b:a 128k output.mp4
- ffmpeg -i input.avi -c:v copy -c:a copy output.mp4
- ffmpeg -i input.avi -acodec copy -vcodec copy input.mp4
Here are the explanations to these commands:
- -c:v libx264: Set the video codec to H.265.
- -c:a aac: Set the audio codec to AAC.
- -preset slow: Use the “slow” preset for encoding. It can balance the compression efficiency and encoding speed.
- -crf 19: Set the Constant Rate Factor to 19 to control the video quality. The lower the crf values, the better the video quality.
- -b:a 128k: Set the audio bitrate to 128kbps.
- -c:v copy/-c:a copy: Copy the video/audio stream from the input file to the output file without the need for re-encoding.
- -acodec copy/-vcodec copy: Copy the codec of the video/audio from the input file without re-encoding it.
You can change the commands to meet your different needs.
Step 5. Activate the conversion
After entering the command, press Enter to activate the conversion process. Then you can see the scene in the screenshot below.
How to Batch Convert AVI to MP4 with FFmpeg
Is there any way to convert several AVI files to MP4 at the same time via FFmpeg? Yes, you can change the conversion command to make batch conversions. For how to batch convert AVI to MP4 with FFmpeg on Windows, you need to type in this command: for %i in (*.avi) do ffmpeg -i “%i” “%~ni.mp4”
Then press Enter to start the batch AVI to MP4 conversion on Windows.
For Mac and Linux users, the batch conversion command is different from Windows. The command is: for i in *.avi; do ffmpeg -i “$i” “${i%.*}.mp4”; done
FFmpeg Conversion Command for MP4 to AVI Conversion
After learning how to convert AVI to MP4 via FFmpeg, it is not difficult to master how to convert MP4 to AVI with it. Here are two basic commands:
- ffmpeg -i input.mp4 output.avi
- ffmpeg -i input.mp4 -c:v libx264 output.avi
Easy Ways to Convert Between MP4 and AVI
Although FFmpeg is a free and open-source tool for video conversion, it is not friendly for beginners. Because it requires users to enter different commands for conversions. If you are a beginner, it needs a steep learning curve. It is recommended to use MiniTool Video Converter for video and audio conversion.
MiniTool Video ConverterClick to Download100%Clean & Safe
MiniTool Video Converter has an intuitive interface and easy-to-use operation. In addition to converting between MP4 and AVI, it can convert a wide range of formats, such as WMV, MKV, M4V, 3GP, VOB, MP3, AAC, and more. Moreover, it offers a batch file conversion feature.
If you want to edit and convert MP4 or AVI files, MiniTool MovieMaker is worth a try. It provides you with various editing features to edit MP4 and AVI videos. Additionally, it enables you to convert AVI and MP4 videos to other formats.
MiniTool MovieMakerClick to Download100%Clean & Safe
You can try the above tools to convert AVI to MP4 or turn MP4 into AVI easily.
Conclusion
It is not difficult to follow the above guidance to use FFmpeg to convert AVI to MP4. Alternatively, you can try its alternatives to make video conversions easily.