VirtualDJ can pre-process stems to save CPU power. Usefully
it stores the processed stems in a .mp4 file with multiple
audio streams. We can extract these using ffmpeg and a simple
Python script:
#!/usr/bin/env python
from subprocess import run, DEVNULL
import re
import sys
import os
what = """
0 vocals
1 hiperc
2 bass
3 synths
4 kick
""".strip().splitlines()
what = dict(x.split(" ") for x in what)
args = sys.argv[1:]
for arg in args:
if not arg.endswith(".vdjstems"):
arg += ".vdjstems"
if not os.path.exists(arg):
print(f"{arg} does not exist")
continue
basename = arg.split("/")[-1]
fnstem = basename.split(".")[:-1]
ext = fnstem.pop()
fnstem = ".".join(fnstem)
for k,v in what.items():
ofn = f"{fnstem}.{v}.{ext}"
cmd = ["ffmpeg","-n","-i",arg,"-c","copy","-map",f"0:{k}",ofn]
run(cmd)