Skip to content

Instantly share code, notes, and snippets.

@jamesmacwhite
Last active April 11, 2024 22:29
Show Gist options
  • Save jamesmacwhite/58aebfe4a82bb8d645a797a1ba975132 to your computer and use it in GitHub Desktop.
Save jamesmacwhite/58aebfe4a82bb8d645a797a1ba975132 to your computer and use it in GitHub Desktop.
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

ffmpeg -i example.mkv -c copy example.mp4

Batch conversion example

If you want to batch convert multiple MKV files, you can switch into the directory that contains MKV files and run the following, depending on OS. This can be run directly from command line. All MKV files found in the directory will be converted with their original filename.

Unix one-liner example i.e. MacOS/Linux:
for f in *.mkv; do ffmpeg -i "$f" -c copy "${f%.mkv}.mp4"; done
Windows one-liner example:
for /R %f IN (*.mkv) DO ffmpeg -i "%f" -c copy "%~nf.mp4"

/R is used to recursively search within sub directories at the target location.

If running within a batch script, you will need to double the percentage signs %% in order for the command to run properly.

In both examples, the original .mkv extension is removed from the final output to avoid the filename ending up as example.mkv.mp4 which would be a bit weird, although harmless.

@therevelatorjohn
Copy link

therevelatorjohn commented Apr 15, 2020

I'm not using Ubuntu to test it but I think you can do that putting the code below after your "do" and before "done".

for x in *.mkv;
do rm "$x" -R;

@LesterCovax
Copy link

#!/bin/bash
for f in *.mkv; 
do ffmpeg -i "$f" -c:v libx264 -preset medium -c:a aac -c:s mov_text "${f%.mkv}.mp4"; 
done

which works fine for me, but I need to remove the original file automatically after conversion, how to do that?
@z4kio
You can re-use the variable before it iterates to the next one, as well as using && to have it on one line and only delete it if it completes. This is far from error-proof though, so be warned. I'm sure there are libraries out there to handle this (and think I've come across some).

for f in *.mkv; 
do ffmpeg -i "$f" -c:v libx264 -preset medium -c:a aac -c:s mov_text "${f%.mkv}.mp4" && rm "{$f}.mkv"; 
done

@R00tqit
Copy link

R00tqit commented May 18, 2020

if your mkv audio is FLAC then you need to convert the audio to something else since FLAC in mp4 is still experimental with FFMPEG
ffmpeg -i example.mkv -vcodec copy -acodec aac example.mp4

THANKS to @Jan02 - I'm on MacOS Catalina 10.15.4 (19E287) using BASH in the MacOS Terminal. This command structure worked for me right away!

To elaborate - I was getting an error when using the more vanilla command of: ffmpeg -i video-title.mkv -c copy video-title.mp4
Pertinent ERROR OUTPUT:
[mp4 @ 0x7fda2f008200] track 1: codec frame size is not set [mp4 @ 0x7fda2f008200] opus in MP4 support is experimental, add '-strict -2' if you want to use it. Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy)

That's what led me here. I read through most of the replies here, and based on my decent knowledge of coding, scripting, and command line work in Linux & MacOS, I chose to go with your suggested commands. As I said, it worked perfectly the first time. Thanks!

@Jan02
Copy link

Jan02 commented May 25, 2020

it says OPUS in mp4 is experimental too

@R00tqit
Copy link

R00tqit commented May 27, 2020

Exactly; that was my main issue, since I started using the far-too simple command ffmpeg -i video.mkv -c copy video.mp4 having no prior knowledge opus was involved in my original file.... And when I looked on the ffmpeg website in documentation, there's "OPUS", then "libopus" which talks about needing "to explicitly configure the build with --enable-libopus" then goes on to state "Most libopus options are modeled after the opusenc utility from opus-tools" and gets more convoluted from there. Simply breaking out the codecs as you did in your command/code just solved the issue, full stop: -vcodec -copy -acodec -aac - It worked from then on out, no errors, no issue, no loss of quality, nor file size, and I've used that command on I think 48 videos over the last week. URL For reference: https://ffmpeg.org/ffmpeg-codecs.html#opus

Sometimes I get so far into trying to solve a specific error message &/or figure something out, I'm not able to realize the simplest answer was staring me in the face the entire time.... Basically a textbook "unable to see the forest through the tress" scenario, lol.

Anyway, thanks again Jan02 - I'm new(er) on githib so hopefully I'm not breaking any rules with this conversational type of reply. I just figured it was worth elaborating on how & why this solved my issue, after you replied & mentioned the OPUS portion of my error message. Also thanks to @talesam for the script!

Cheers.

@liberodark
Copy link

Have make this script for my project : https://github.com/YunoHost-Apps/streama_ynh

#! /bin/bash
while IFS= read -r -d '' file
do
  ffmpeg -nostdin -i "$file" -vcodec h264 -acodec aac -strict -2 "${file%.*}.mp4"
  rm -f "$file"
done <   <(find your_dir -name '*.mkv' -print0 -o -name '*.avi' -print0)

Work great and support white space too.

@Artic0din
Copy link

Artic0din commented Aug 25, 2020

Anybody been able to get the Unix/MACOS to do recursive?

I’ve got files within folders in the directory that need converting but the code below will only do the top directory nothing below it.

for f in *.mkv; do ffmpeg -i "$f" -c copy "${f%.mkv}.mp4"; done

@limkokhole
Copy link

limkokhole commented Aug 25, 2020

for f in *.mkv; do ffmpeg -i "$f" -c copy "${f%.mkv}.mp4"; done

Either do (bash version 4 above):

shopt -s globstar
for f in **/*.mkv; do ffmpeg -i "$f" -c copy "${f%.mkv}.mp4"; done 

Or find [Wrong]:
find . -iname '*.mkv' -exec ffmpeg -i "{}" -c copy "${f%.mkv}.mp4" \;

[Correction]:
find . -iname '*.mkv' -exec bash -c 'ffmpeg -hide_banner -y -i "{}" -c copy "${0%.mkv}".mp4' {} \;

@josephzitt
Copy link

find . -iname '*.mkv' -exec ffmpeg -i "{}" -c copy "${f%.mkv}.mp4" ;

The find command is giving me, after the first one,
File '.mp4' already exists. Overwrite ? [y/N]

I suspect the problem is the argument in "${f%.mkv}.mp4"
The "f" in it seems to be an artifact from the for command above it.
Is this so? How can I get the proper filename in there? I'm a bit baffled by the workings of arguments within find, especially when it comes to the curly brackets.

@limkokhole
Copy link

limkokhole commented Sep 13, 2020

find . -iname '*.mkv' -exec ffmpeg -i "{}" -c copy "${f%.mkv}.mp4" ;

The find command is giving me, after the first one,
File '.mp4' already exists. Overwrite ? [y/N]

I suspect the problem is the argument in "${f%.mkv}.mp4"
The "f" in it seems to be an artifact from the for command above it.
Is this so? How can I get the proper filename in there? I'm a bit baffled by the workings of arguments within find, especially when it comes to the curly brackets.

Oops, my bad, $f was the output of first command.

find doesn't have a substitution feature, you need do like that:

find . -iname '*.mkv' -exec bash -c 'echo -e "From\t: "{}" \nTo\t: "${0%.mkv}".mp4"' {} \; # preview

find . -iname '*.mkv' -exec bash -c 'ffmpeg -hide_banner -y -i "{}" -c copy "${0%.mkv}".mp4' {} \; # convert

find . -iname '*.mkv' -exec bash -c 'ffmpeg -hide_banner -y -i "{}" -strict experimental -c copy "${0%.mkv}".mp4' {} \; # Fix Opus error in old ffmpeg(Output file still no sound in my case but at least not 0 file size), see https://stackoverflow.com/a/54223095/1074998

@Artic0din
Copy link

Artic0din commented Sep 13, 2020

Thanks @limkokhole this is working well now with the multiple folders instead of stopping in the 1 directory thanks for the new commands. Is it also possible to get the script to also delete the file it converted from so I don't have to manually delete them?

On a seperate note....

Is this script suppose to copy all audio and video streams in the mkv container? I've had a few videos files that have multiple language audio tracks in them (Track #1 - Russian, Track #2 English etc) but once the conversion is complete its stripped all the audio except the first track which isn't a problem IF the first track is English but I've found often its not and I end up with only Russian audio.

@limkokhole
Copy link

limkokhole commented Sep 13, 2020

Thanks @limkokhole this is working well now with the multiple folders instead of stopping in the 1 directory thanks for the new commands. Is it also possible to get the script to also delete the file it converted from so I don't have to manually delete them?

On a seperate note....

Is this script suppose to copy all audio and video streams in the mkv container? I've had a few videos files that have multiple language audio tracks in them (Track #1 - Russian, Track #2 English etc) but once the conversion is complete its stripped all the audio except the first track which isn't a problem IF the first track is English but I've found often its not and I end up with only Russian audio.

To delete file after convert, simply append && rm "{}" inside bash -c '', which && means that only run next command (rm command in this example) if previous command convert/return successfully. You probably don't want delete file if failed to convert.

And to copy all tracks is popular question, see answer here which use -map 0(I don't have multi-tracks file to test it).

So the final command:

find . -iname '*.mkv' -exec bash -c 'ffmpeg -hide_banner -y -i "{}" -strict experimental -c copy -map 0 "${0%.mkv}".mp4 && rm "{}"' {} \;

Note that some .mkv might need to re-encode and it might failed to play in mplayer player, in that case either you want to re-encode that files without -c copy option OR play with better player such as mpv player.

@josephzitt
Copy link

Thanks, @limkokhole . I used your revised find command, further specifying H.264 video and AAC audio (so my Android TV wouldn't be hit with stuff it couldn't handle. It worked flawlessly on a folder including subfolders with several dozen MKV files. I'll be using it regularly.

@danielb2
Copy link

what about when you want to include the subtitles?

   Stream #0:2(eng): Subtitle: ass (default)
   Metadata:
     BPS-eng         : 197
     DURATION-eng    : 00:21:04.370000000
     NUMBER_OF_FRAMES-eng: 396

trying with -c:s ass
but got:

Could not find tag for codec ass in stream #2, codec not currently supported in container

also tried mapping to no avail

@RobinSc006
Copy link

There's a problem with the Windows batch convert command. Every time I would put this in a batch file and run it, it would instantly close as soon a I ran it. What I found as a solution was instead of writing
for /R %f IN (*.mkv) DO ffmpeg -i "%f" -c copy "%~nf.mp4"
I would write
for /R %%f IN (*.mkv) DO ffmpeg -i "%%f" -c copy "%%~nf.mp4"

All that was changed is I added another % in front of f.
Hope this helps anyone else who gets this problem!

Thank you so much!

@heroyu
Copy link

heroyu commented Jan 18, 2021 via email

@Grimmrp2
Copy link

Grimmrp2 commented Feb 2, 2021

Thanks @limkokhole this is working well now with the multiple folders instead of stopping in the 1 directory thanks for the new commands. Is it also possible to get the script to also delete the file it converted from so I don't have to manually delete them?
On a seperate note....
Is this script suppose to copy all audio and video streams in the mkv container? I've had a few videos files that have multiple language audio tracks in them (Track #1 - Russian, Track #2 English etc) but once the conversion is complete its stripped all the audio except the first track which isn't a problem IF the first track is English but I've found often its not and I end up with only Russian audio.

To delete file after convert, simply append && rm "{}" inside bash -c '', which && means that only run next command (rm command in this example) if previous command convert/return successfully. You probably don't want delete file if failed to convert.

And to copy all tracks is popular question, see answer here which use -map 0(I don't have multi-tracks file to test it).

So the final command:

find . -iname '*.mkv' -exec bash -c 'ffmpeg -hide_banner -y -i "{}" -strict experimental -c copy -map 0 "${0%.mkv}".mp4 && rm "{}"' {} \;

Note that some .mkv might need to re-encode and it might failed to play in mplayer player, in that case either you want to re-encode that files without -c copy option OR play with better player such as mpv player.

How could I use this but convert the audio to 2.0 AAC and keep the dts or AC3 original audio too?

@candrapersada
Copy link

candrapersada commented Aug 9, 2021

need script to remove after convert, ffmpeg is like

for /r %%F in (*.mkv) do (
    ffmpeg.exe  -i "%%F" -vcodec copy -acodec copy "%%~dpnF.mp4"
    if not errorlevel 1 if exist "%%~dpnF.mp4" del /q "%%F"
)

for Linux

@df-a
Copy link

df-a commented Jan 1, 2022

The opposite also works fine.

ffmpeg -i example.mp4 -c copy example.mkv

@sshuangliu
Copy link

sshuangliu commented Feb 12, 2022

I just wondering........about '-c copy', why not directly change the extension of the file to 'mp4' ???? Won'that be faster? LOL

I need to convent the mkv to mp4 for the HTML5 video player doesn't support DTS, AAC and AC3 audio codecs,
and I just followed the above guide and the "new" mp4 file doesn't work as well , so what did actually change after convent the mkv file with "-c copy" ?

many thanks

@Rylazius
Copy link

C:\Users\no u cant see this\Downloads>ffmpeg -i video.mkv -c:v libvpx -b:v 1M -c:a libvorbis -map 0:d intro2.mp4
ffmpeg version 4.3.1-2020-11-02-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, matroska,webm, from 'video.mkv':
Metadata:
ENCODER : Lavf57.41.100
Duration: 00:00:10.01, start: -0.007000, bitrate: 21996 kb/s
Stream #0:0: Video: vp8, yuv420p(progressive), 3840x2160, SAR 1:1 DAR 16:9, 1k fps, 60 tbr, 1k tbn, 1k tbc (default)
Metadata:
DURATION : 00:00:09.990000000
Stream #0:1: Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
DURATION : 00:00:10.008000000
Stream map '0:d' matches no streams.
To ignore this, add a trailing '?' to the map.

C:\Users\MinhLong\Downloads>ffmpeg -i video.mkv -c:v libvpx -b:v 1M -c:a libvorbis -map 0:v intro2.mp4
ffmpeg version 4.3.1-2020-11-02-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, matroska,webm, from 'video.mkv':
Metadata:
ENCODER : Lavf57.41.100
Duration: 00:00:10.01, start: -0.007000, bitrate: 21996 kb/s
Stream #0:0: Video: vp8, yuv420p(progressive), 3840x2160, SAR 1:1 DAR 16:9, 1k fps, 60 tbr, 1k tbn, 1k tbc (default)
Metadata:
DURATION : 00:00:09.990000000
Stream #0:1: Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
DURATION : 00:00:10.008000000
File 'intro2.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (vp8 (native) -> vp8 (libvpx))
Press [q] to stop, [?] for help
[libvpx @ 00000000026a2dc0] v1.9.0-100-g220e4331b
[mp4 @ 000000000265e640] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!

i have this problem!

@broper81
Copy link

broper81 commented Apr 14, 2022

Thank you so much!!
After upgrading my LG TV, come to find out that while the new one certainly has a nicer picture, it no longer supports DTS! :(
After manually converting the DTS to AAC and being disappointed, then trying again from source into AC3, I just still couldn't live with the lossy to lossy results. I found the special effects were still pretty superb, but surprisingly the speech was a bit muffled (to my ears at least). After trying and failing to convert back from source to truehd (VLC wouldn't even play it), I discovered that LG TV supports FLAC from inside an MP4 container, yas! Sure I could have used mkv but I like mp4 better because most of my other videos (already aac/ac3) are mp4 and I'm ocd I guess. Granted the file size will go up, but going lossy to lossy just wasn't bringing me joy, and isn't that the point? But main thing as well was I was hating my life thinking about opening all those powershell windows and converting the videos one by one again (about 300-400 videos). This worked like a charm!! If anyone is interested, this modified line will copy the video and transcode just the audio to lossless flac. Or if interested in a different format just change the flac part to aac, ac3, mp3 etc etc. Thanks again, I doubt I would have been able to summon this (cheat)code on my own! Just filled in your script with what I needed. The "-strict -2" part is because flac to mp4 container is "experimental" but tested working fine on LG TV from usb input. On any non-tested device would probably recommend sticking with mkv for flac audio. Windows 10/PowerShell:

Get-ChildItem -Filter '*.mkv' | % { &.\ffmpeg -i .$($.BaseName).mkv -acodec flac -vcodec copy -strict -2 .$($.BaseName).mp4 }

@LaserSlime
Copy link

Does this support multiple audio streams?

@fevillarreal
Copy link

Thanks, It worked like a charm

@broper81
Copy link

Does this support multiple audio streams?
Sorry, didn't see this till today. I'll be 100% honest, I'm 99.99% confident it would support it, because mp4 container certainly does, but...I do not know how exactly to work that into the command. May take some experimenting.

Thanks, It worked like a charm
Great! ☺️

@illusive-man
Copy link

illusive-man commented Oct 29, 2023

Doesn't work with multiple audio tracks. 5 of those in mkv were flatten to a single audio track (default one) in mp4.

@jamesmacwhite
Copy link
Author

It was never written with multiple audio tracks in mind, but I can add that note for reference.

@cherrynoize
Copy link

Hi, I'm getting a

[mp4 @ 0x55a4ac0a19c0] Could not find tag for codec ffvhuff in stream #0, codec not currently supported in container
[out#0/mp4 @ 0x55a4ac0a18c0] Could not write header (incorrect codec parameters ?): Invalid argument
[vost#0:0/copy @ 0x55a4ac0a2140] Error initializing output stream:
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
    Last message repeated 1 times

error. So I tried using aac for the output audio but get the same message.

Adding -f alsa gives me this:

$ ffmpeg -i "in.mkv" -f alsa -c:v copy -c:a aac "out.mp4"
[out#0/alsa @ 0x55e811478900] Output file does not contain any stream

Any idea how to solve this?

@number415
Copy link

number415 commented Feb 4, 2024

Thank you! Your solution was the only one that worked on my M1 Mac mini after hours of searching and trying others.
Question: Since I am on a Mac I know that once I change the container with -c copy, the resulting .mp4 file doesn't play nice with MacOS. Examples: Quicktime plays but no audio, Thumbnails are not there. I found that to get the output fill to play nice with MacOS you need to Use the -tag:v hvc1 parameter in your FFmpeg command to make your HEVC file work on Apple devices.

Example: ffmpeg -i Aliens.mkv -c copy -tag:v hvc1 Aliens.mp4

I am able to get this to work with single files but not in a batch. Any advice?

@bluttmer
Copy link

Hello,

I am trying to get this to work with using folders within a folder. When run the script on a path it puts the mp4 files in the root folder instead of where the files were, that causes issues with files with same name.

example.

I run the script from this folder...

C:\Users\me\Downloads\Smallville (2001)

This folder has folders within folders and some files would have same name. ie "Disc 1.mkv" under Features

C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 2\Deleted Scenes\Disc 1.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 2\Deleted Scenes\Disc 2.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 2\Deleted Scenes\Disc 3.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 2\Deleted Scenes\Disc 4.mkv

C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 3\Deleted Scenes\Disc 1.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 3\Deleted Scenes\Disc 2.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 3\Deleted Scenes\Disc 3.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 3\Deleted Scenes\Disc 4.mkv

C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 4\Deleted Scenes\Disc 1.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 4\Deleted Scenes\Disc 2.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 4\Deleted Scenes\Disc 3.mkv
C:\Users\me\Downloads\Smallville (2001)\Featurettes\Season 4\Deleted Scenes\Disc 4.mkv

the converted files are put under so then it keeps asking me to rename files that have same name ie Disc 1.mkv is repeated several times.
C:\Users\me\Downloads\Smallville (2001)\

This is what is in the batch file...

for /R %%f in (*.mkv) do "ffmpeg.exe" -i "%%f" -vcodec copy -acodec copy "%%~nf.mp4"

Any help is appreciated.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment