VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    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"
    Quote Quote  
  2. Originally Posted by sambat View Post
    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"
    change “%%~ff.mkv” to “%%~nf.mkv” or ""%%~dpnf.mkv""
    Quote Quote  
  3. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    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.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!