I typically use DVDFab to remux MKVs to remove subtitles and foreign languages. Recently the remux feature started hanging and it was suggested by someone in the DVDFab forum to use MKVMerge.

I had MKVMerge GUI on hand already and around the same time I started experimenting with Popcorn to convert DTS tracks to Dolby Digital.

So I already know that I can use Popcorn to convert a DTS track to AC3 and mux the track into the video. What I'm interested in knowing is if it is possible to do one of two things:

1. Script MKVMerge or Popcorn to convert DTS to AC3 and then remux the file so all non-English audio tracks are removed, the AC3 audio track is made the default, and all subtitle tracks are removed.

2. Script MKVMerge to remove all non-English audio tracks, make the English AC3 track the default if it exists, otherwise make the English DTS track the default, and remove all subtitle tracks.

I'm most interested in making #1 work. I'm hoping to run the script against a list of MKV movies to avoid having to do each one separately. Popcorn does the DTS to AC3 conversion and remuxes the MKV in a matter of minutes. MKVMerge GUI remuxes the MKV (subtitles and other languages removed) in a matter of minutes as well . . .

but nothing beats the efficiency of scripting both programs to work together or, better yet, scripting one of the programs to do it all. I just don't know where to start.

If you have experience with this, are very familiar with this software or can recommend another piece of software that can do it all programmatically please comment. Thanks!