If you deal with video files frequently, you know the struggle of having a folder full of .mkv files that won't play correctly in certain media players or video editing software (like Adobe Premiere Pro). While there are hundreds of bulky "video converter" apps online, they are often slow, packed with ads, or put watermarks on your videos.
The absolute best and fastest way to convert video files is by using FFmpeg combined with a simple Windows Batch script. Because we are only swapping the container (from MKV to MP4) and copying the video track without re-encoding, this method takes seconds rather than hours, and there is absolutely zero quality loss.
Here is how you can set up a script to batch convert a whole folder of MKV files instantly.
Step 1: Install FFmpeg
If you don't already have FFmpeg installed:
- Download it from the official FFmpeg website or install it via winget:
cmd
winget install ffmpeg - Make sure it is added to your Windows
PATHenvironment variable so you can run it from any folder.
Step 2: Create the Batch Script
- Open up Notepad.
- Paste the following code into the editor:
@echo off
for %%f in (*.mkv) do (
echo Converting "%%~nf.mkv" to "%%~nf.mp4"
ffmpeg -i "%%~nf.mkv" -c:v copy -c:a aac -strict experimental "%%~nf.mp4"
)
echo All files converted!
pause- Save the file and name it something like
mkv_to_mp4.bat. Make sure you change the "Save as type" from "Text Documents (*.txt)" to "All Files" so it saves with the.batextension.
How the Script Works
Let's break down why this script is so powerful:
for %%f in (*.mkv) do (...): This loop looks for every single.mkvfile in the folder where you run the script.-c:v copy: This is the magic command. It tells FFmpeg to copy the video stream directly without re-encoding it. This is why the conversion happens instantly and without quality degradation.-c:a aac: It converts the audio to standard AAC format, ensuring perfect compatibility with MP4 players and editing tools.
Step 3: Run the Script
- Place your newly created
mkv_to_mp4.batscript into the folder containing your MKV videos. - Double-click the
.batfile. - A command prompt window will open, and you will see FFmpeg instantly converting every file in the folder!
Conclusion
Automating simple, repetitive tasks like video conversion can save you hours of waiting time. By leveraging the power of FFmpeg and a simple Windows Batch script, you get the fastest, highest-quality MKV to MP4 conversion process possible.
Tech Stack: Windows Batch, FFmpeg, Command Line
