I want to convert multiple folders of mp4 files to mkv.
Also, I want the new mkv files to appear in the same locations as the source mp4 files.
The batch file does this, but it is also adding the extension (mp4) of the source to the converted file.
Example:
somefile.mp4 when converted becomes somefile.mp4.mkv
It's not causing any errors and MediaInfo recognizes the new file as mkv, but I would like to know how to tell the bat file to drop mp4 from the new file name.
rem recurse and save new file in the same folder as the source.
for /R %%f IN (*.mp4) DO ffmpeg -i "%%f" -c copy "%%~ff.mkv"
+ Reply to Thread
Results 1 to 3 of 3
-
-
-
Many thanks, "%%~dpnf.mkv" did the trick.
The new mkv files appear in the same folder(s) as the source mp4's, with the correct extension.
Note: %%~nf.mkv saves all the new mkv files to the root folder where the bat file is located - which is good, but I wanted them in the source folder.
Thanks again.
Similar Threads
-
Batch Script for mux mp4 to mkv using mkvmerge
By iKron in forum Newbie / General discussionsReplies: 5Last Post: 25th Aug 2025, 16:18 -
Is there an App can batch mux mp4 and srt files into MKV on MacOS?
By shruru in forum MacReplies: 4Last Post: 21st Jun 2023, 17:48 -
How to batch merge a mp4 video with several subtitles into a single mkv
By javidial in forum Video ConversionReplies: 4Last Post: 2nd Oct 2021, 15:06 -
How do I convert MKV to MP4 in batch with burned-in subs? (Vidcoder)
By fighuass in forum Video ConversionReplies: 12Last Post: 29th Aug 2021, 13:02 -
[FFMPEG BATCH SCRIPT] Remux MP4 to MKV removing all details data!
By Cauptain in forum Video ConversionReplies: 3Last Post: 12th Aug 2021, 04:38



Quote