VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Hello.
    I'm currently using ffmpeg to convert my mkv files with e-ac3 audio to ac3, with this command line:

    Code:
    ffmpeg  -hwaccel auto -y -i "input.mkv" -map 0 -c:s copy -c:v copy -c:a ac3 -b:a 640k "output.mkv"
    It works great, but it takes a long time when you have more than 1 file. So do you if there is a way to batch convert several files, instead of opening a different command line each time?

    Thank you.
    Quote Quote  
  2. for %a in (*.mkv) do ffmpeg -y -i "%a" -map 0 -c:v copy -c:a ac3 -b:a 640k -c:s copy "output_%~na.mkv"

    ("%%" instead of "%" if in a batch file)
    Quote Quote  
  3. Sorry, can you explain in more details? I don't get what to do (I'm still a beginner). Thanks.
    Quote Quote  
  4. Originally Posted by Nico Darko View Post
    Sorry, can you explain in more details? I don't get what to do (I'm still a beginner). Thanks.
    Just create new script with provided example.
    btw '-hwaccel auto' will not increase any speed...

    Code:
    for %%a in (*.mkv) do ffmpeg -y -i "%%a" -map 0 -c:v copy -c:a ac3 -b:a 640k -c:s copy "output_%%~na.mkv"
    Quote Quote  
  5. I'm sorry, I know nothing about coding, I was simply given the instructions to do that one conversion, and it worked. But where do I enter the files names in that code? I have 12 in the same folder.

    Sorry if I'm a pain.
    Quote Quote  
  6. You don't enter file names at all. The "for" command will automatically pick up and enter the file names for you in a loop.
    Quote Quote  
  7. Ok, that's what I thought, but I entered your command line, but it's not working, it says %%a was unexpected.
    Quote Quote  
  8. If you are entering in command line use single %
    In batch file %% (double)
    Quote Quote  
  9. OK! Now it's working! Thank you!!
    Quote Quote  
  10. Member
    Join Date
    Nov 2017
    Location
    Madrid, Spain
    Search PM
    You can use this tool in the future for batch converting and saving your ffmpeg long presets:
    FFmpeg Batch
    Quote Quote  
  11. Member pumpysworld's Avatar
    Join Date
    Feb 2006
    Location
    The Wasteland
    Search Comp PM
    I also used the freeware Xmedia Recode to convert the audio tracks of MKVs. I set it to copy (not convert) the video and converted the audio to AC3.
    Quote Quote  
  12. Just wanted to share this. I am running Ubuntu Linux and none of the above solutions worked for me. I combined stuff and now works like a charm. It just takes a few seconds to convert large files. Hope This Helps for others

    Code:
    #!/bin/bash
    for f in *.mkv; do ffmpeg -y -i "$f" -map 0 -c:v copy -c:a ac3 -b:a 640k -c:s copy "${f%.*}-ac3.mkv"; done
    Quote Quote  



Similar Threads