Free Download
Download Best Alternative to FFmpeg and Convert Easily
AuthorRecommended by the author
Free Download X

SoftwareHow to & Tips

Video FormatsConvert Video

Resources

FFmpeg Tutorial 101 - FFmpeg MKV to MP4 Conversion

Author by Cooper

Updated on Dec 10, 2021

FFmpeg offers a powerful way to convert MKV to MP4 as it allows fast video remuxing and multithreading. The process is command line-based and it won’t be easy for beginners, though. So here I will provide a detailed guide on FFmpeg MKV to MP4 conversion. Hope you’ll like it.

Tips. Inexperienced users can also take this handy yet professional video converter that also supports MKV remuxing and batch conversion. The process is way more streamlined:

Part 1. Basic Parameters of FFmpeg Command Lines in Conversion

FFmpeg is hard to use for novices. For better FFmpeg convert MKV to MP4, knowing about the basic parameters of each FFmpeg command line can help a lot. When you well know it, you can master FFmpeg MKV to MP4 more easily. For different command lines, there are various parameters. So basically, I will introduce the most used parameters to you here and more detailed ones in specific operations.

A basic ffmpeg command line

1. ffmpeg: a necessary part for announcing to the OS who is using the command line.

2. –i: the abbreviation of input, means the following file is the original file to be converted.

3. input.mp4: the file that is to be converted. You can input two files at once by inputting: ffmpeg –i input1.mp4 –i input2.mp4

4. output.mkv: the output file in an MKV container. You can modify the format according to your needs. Thanks to the power procession ability, you don’t need to consider about the audio and video encoder. FFmpeg will choose the most suitable ones.

Part 2. Configure and Enable FFmpeg

To convert MKV to MP4 FFmpeg, you should first download and configure FFmpeg in advance. If you are a novice here. Read on this part to learn how to download and configure FFmpeg. If not, please click here to bypass this section.

Download FFmpegDownload FFmpeg

Step 1. Download FFmpeg

You can download FFmpeg for Windows, Linux and Mac from its official download site - https://ffmpeg.org/download.html.

Here, I will download a version for Windows and introduce the configuration steps on the basis of it.

Copy binary folder addressDownload FFmpeg

Step 2. Configure FFmpeg

After you download the .zip files from the site above, right-click it to extract files to your desktop. Save the extracted files anywhere you like.

Open the location and find the binary file folder of FFmpeg. On the address bar, select the address and copy it.

Modify path variablesModify path variables

Press the Win button on your keyboard and input "system" into the search bar. Click system under the Control Panel tab. Head to the left side of the new pop-up window, find and click Advanced system settings. Then click > Environment variables… > find Path in System variables table. Double-click Path to edit. Press Ctrl + V to paste the location address of the binary file folder of FFmpeg at the end of the original value bar. Please make sure the original ends with ";". If not, just add it.

Part 3. Methods on FFmpeg MKV to MP4 Conversion

Right now, it is the high–time to learn how to convert FFmpeg MKV to MP4. Please read the following guides carefully, you will receive a lot.

Operation 1. Change a Container Only

What is required by this operation is the same as that shown at the start of the article, i.e. ffmpeg –i input.mkv output.mp4. The corresponding parameters are also introduced, so let us bypass this part together. By the way, FFmpeg remux MKV to MP4 does not require transcoding at all.

My MKV filesMy MKV files

Operation 2. Batch FFmpeg MKV to MP4 Conversions

If you have several MKV files and want to convert them into MP4 in batches. FFmpeg can also help you. To do this, you should use the DOS window to enter the folder where storing the .mkv files. For example, the path of my MKV folder is D:\mkvFolder, how can I batch FFmpeg convert MKV to MP4?

DOS WindowsDOS Windows

Step 1. Press Win + R and input cmd to enter the DOS window. Input d: to enter the D disk.

Step 2. Input cd mkvFolder . Now, I am in the location of MKV folder.

Step 3. Input FFmpeg command line: for /R %f IN (*.mkv) Do ffmpeg -i "%f" –c copy "%~nf.mp4" After that, I get the desired .mp4 files.

About the parameters:

The converted filesThe converted files

This command line can be divided into two parts, i.e. the looping part – for /R %f IN (*.mkv) Do and the FFmpeg line part – ffmpeg –i "%f" –c copy "%~nf.mp4".

The first part is used to determine whether there are more .mkv files, if the answer is right, the FFmpeg MKV to MP4 conversion will start and stop till the answer turns to false.

The second part is similar to operation 1. The differences between them are the input file name, output file name, and –c copy. Input name matches with the file found in the looping part, and %~nf means the output names should be named as the same as original names. Lastly, -c copy means the original stream codec will be kept as the same as the original video and audio streams, instead of being changed. That’s to say, no transcoding.

Change CodecsChange Codecs

Operation 3. Change Codecs for Video and Audio Streams

If you operate the methods above, the output file is encoded with the original codecs, which maybe not the certain ones you want. For that, FFmpeg also allows you to modify the codecs to a certain one. For example, if you want to FFmpeg convert to MP4 with H264 codec. You can input: ffmpeg –i input.mkv –c:v h264 output.mp4

About the parameters

-c:v means the following character is used to nominate the codec of video. You can also input –c:a to nominate the codec of audio, such as ffmpeg –i input.mkv –c:a aac output.mp4 If you do not know which codecs are supported by your FFmpeg, you can input FFmpeg –codecs in the DOS windows to get the codec list.

Summary

Now, you have learned how to make FFmpeg convert MKV to MP4. You can also modify the input file and output file name to process conversions, such as MP4 to AVI, MKV to AVI and the like. Besides various conversions, FFmpeg further allows you to crop videos, make videos from images, make GIFs from videos and so forth. But to be honest, it is really hard to process them via FFmpeg. Personally, I prefer a user-friendly GUI converter, such as WonderFox HD Video Converter Factory Pro. Here is a simple tutorial video on how to convert MKV to MP4 via this recommended application. Check it out.

Free Download Free Download

More of HD Video Converter Factory Pro

The Best Free Video Converter

HD Video Converter Factory Pro

1. Save SD/HD/FHD/2K/4K/8K movies and music from 1000+ websites;

2. Download YouTube videos and playlists to MP4, MP3… at fast speed;

3. Fix unsupported format/codec issue by converting between 500+ profiles;

4. Batch compress large video files to half size without losing quality;

5. Enhance video from SD to HD or downscale video from 4K to 1080P;

6. Merge, trim, crop, watermark, add special effects to videos at will;

7. Record meetings, gameplay, streaming content… with audio in HD;

Free Download HD Video Converter Factory Free Download HD Video Converter Factory

More Related Articles

The Best Free MKV to MP4 Converter - To Fast Transfer Video from MKV to iPad 3 Simple Methods on How to Fix MKV Windows 10 Playback Issue How to Convert MP4 to MKV
Sony Vegas MKV Issue – How to Import MKV in Sony Vegas Pro How to Play MKV Files on Samsung Smart TV? How to Play MKV on Android Devices Smoothly