Batch Convert MKV to MP4 with FFmpeg
45sShows a quick, practical solution for a common video file conversion problem.
▶ Play ClipThis tutorial demonstrates how to batch convert MKV files to MP4 using FFmpeg without re-encoding, preserving quality. It covers navigating to the folder in command prompt, using a for loop to process multiple files, and cleaning up filenames.
The video covers batch converting MKV to MP4 with same quality using FFmpeg. Ensure FFmpeg is installed.
Open command prompt (cmd), use 'cd desktop' then 'cd mkv' to reach the folder containing MKV files.
Command: ffmpeg -i file.mkv -c copy file.mp4. This copies streams without re-encoding.
Use 'for -r %f in (*.mkv) do ffmpeg -i %f -c copy %~nf.mp4' to convert all MKV files recursively.
Use '%~nf' to remove the .mkv extension, resulting in clean .mp4 filenames.
Press Enter to run the loop. MKV files are copied to MP4; originals remain. Conversion is fast for files around 100-400 MB.
Batch converting MKV to MP4 with FFmpeg is straightforward using a for loop and the -c copy flag to avoid re-encoding. The process preserves quality and is efficient for multiple files.
"Title accurately describes the tutorial; it delivers exactly what it promises."
What command converts a single MKV file to MP4 without re-encoding?
ffmpeg -i file.mkv -c copy file.mp4
01:06
What flag in FFmpeg copies streams without re-encoding?
-c copy
01:16
How do you batch convert all MKV files in a folder using a for loop?
for -r %f in (*.mkv) do ffmpeg -i %f -c copy %~nf.mp4
01:43
What does the '%~nf' syntax do in the for loop?
It removes the .mkv extension from the filename, resulting in a clean .mp4 filename.
02:45
What does the '-r' flag do in the for loop?
It makes the loop recursive, processing files in subfolders as well.
01:45
Single File Conversion Command
Core technique for lossless container switching.
01:06Batch Conversion with For Loop
Efficient method to process multiple files automatically.
01:43Filename Cleanup with %~nf
Prevents messy filenames like .mkv.mp4.
02:45[00:00] welcome to the learning zone today we're
[00:01] gonna be batch converting mkv files to
[00:03] mp4 files with the same exact quality
[00:06] and it will not take that long but make
[00:08] sure you have ffmpeg installed on your
[00:10] computer if you don't have it already
[00:12] installed on your computer i have a
[00:13] tutorial on how to do that you can click
[00:15] the link right above but first what
[00:17] we're going to do is navigate to your
[00:20] command prompt so you can do that by
[00:21] going into the windows search bar at the
[00:23] bottom typing in cmd and the command
[00:26] prompt will show up and you can click on
[00:28] that so now that we have our command
[00:31] prompt open what we are going to do is
[00:33] navigate to the directory that has all
[00:35] of our mkv files so i have a folder on
[00:38] my desktop called mkv and so we're going
[00:41] to go there by typing in cd desktop
[00:44] and what that cd does is tells it what
[00:47] directory to go to so cd desktop and it
[00:49] goes to the desktop and now we need to
[00:51] go to our mkv folder see the mkv and now
[00:54] we are in the mkv folder on our desktop
[00:56] if you need to go back you do cd dot dot
[00:58] and it'll go back a directory so cd mkb
[01:02] so now we are where all of our files are
[01:04] at and what we can do if we just want to
[01:06] convert one is do ffmpeg
[01:08] dash i
[01:10] and then the file name file dot mkv make
[01:13] sure to have the mkv in it
[01:15] dash c
[01:16] copy so basically this is just moving it
[01:19] from the mkv container to the mp4
[01:22] container it's not re-encoding or doing
[01:23] anything like that we're just moving
[01:25] containers and it will be basically the
[01:27] same file size basically the same file
[01:29] but in dot mp4
[01:31] and then file.mp4 you can name it
[01:33] whatever you want just make sure you
[01:34] have the dot mp4 and then that is just
[01:37] for one however we want to batch convert
[01:39] we want to do a whole series of them
[01:41] but what we want to do is a for loop so
[01:43] we're going to do four
[01:45] dash r and this will look recursively in
[01:48] all of the subfolders so if you have a
[01:49] bunch of folders within these folders um
[01:52] it will also convert all of those
[01:54] and then for the files
[01:57] in
[01:58] with the name
[01:59] dot mkv
[02:02] dot
[02:04] mkv
[02:05] and we're going to tell it what to do so
[02:07] for all the files that are mkv files do
[02:10] ffmpeg pretty much what we did before
[02:14] dash i
[02:15] and then this is going to be the file
[02:17] name percent f
[02:18] so the file
[02:20] dash c
[02:22] copy which is what we did before
[02:25] and then what we want to do
[02:26] is the new file dot mp4 so we can do
[02:30] percent f dot mp4
[02:33] just like that however we also want to
[02:35] clean it up a little bit by getting rid
[02:37] of the dot mkv at the end so
[02:39] if we just did it like this it'll be
[02:41] mkv.mp4 which is a little messy looking
[02:43] so we're going to do
[02:45] tilde n
[02:46] to get rid of that mkv at the end so
[02:49] it'll now just say mp4 now if you're
[02:52] doing this within a batch already you
[02:54] can do percent percent f and then for
[02:57] everything instead of percent f and
[02:58] it'll do the same exact thing
[03:01] but this should get you what you need so
[03:03] now we're going to hit enter and it'll
[03:05] go through and convert all of our mkv's
[03:08] to mp4s it will leave all the mkvs don't
[03:10] worry it's just copying them over you
[03:12] can delete them later if you'd like and
[03:13] just like that i think that was about
[03:14] seven or so files that we converted from
[03:16] mkv to mp4 they were all somewhere
[03:18] around 100 to 400 megabytes big
[03:21] so if you have larger files it'll
[03:22] probably take a little bit longer so
[03:24] thank you for james mac white on github
[03:26] for sort of this example i kind of went
[03:28] through that if you also need that for
[03:29] mac i will leave that in the description
[03:31] that's slightly different and if you
[03:33] have any issues for example if you have
[03:34] like a different audio type free mkv
[03:36] file that mp4 doesn't support you may
[03:37] have to convert it over but if you click
[03:39] the link in the description it kind of
[03:41] goes over all of those different
[03:42] solutions so make sure to check that out
[03:44] if you have any problems and if you have
[03:45] any other problems in general you can
[03:47] let me know in the comments and i'll try
[03:48] my best to help thank you so much for
[03:50] watching make sure to leave a like and
[03:51] subscribe for more videos like these in
[03:53] the future if you have any suggestions
[03:54] for future videos let me know as well
[03:56] thank you for watching i'll see you next
[03:58] time this is the learning zone
⚡ Saved you time reading this? Transcribe any YouTube video for free — no signup needed.