Get the track information
mkvmerge -i /path/to/matroska.file.mkv
Sample output
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_DTS)
This means that the matroska.file.mkv contains two tracks, a video track with id 1 and a DTS track with id 2.
Extract the DTS track
2 is the DTS track ID from the given example.
mkvextract tracks /path/to/matroska.file.mkv 2:/tmp/dts.file.dts
Converting the DTS track to AC3
dcadec -o wavall /tmp/dts.file.dts | aften - /tmp/ac3.file.ac3
Remux the AC3 track into MKV
mkvmerge -o /tmp/matroska.file.mkv /path/to/matroska.file.mkv /tmp/ac3.file.ac3
Verify
mkvmerge -i /tmp/matroska.file.mkv
Sample output
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_DTS)
Track ID 3: audio (A_AC3)
Delete temporary files
rm /tmp/dts.file.dts
/tmp/ac3.file.ac3
Remove the DTS track
3 is the AC3 Track ID from the given example (see Verify)
mkvmerge -o /tmp/matroska.file.ac3.only.mkv -a 3 /tmp/matroska.file.mkv