sf1000/convert.py

24 lines
553 B
Python

import subprocess
import os.path
import functools
import fileinput
@functools.lru_cache()
def ffmpeg_path():
""" Get the path to the bundled FFMPEG binary """
import pyffmpeg
ffmpeg = pyffmpeg.FFmpeg().get_ffmpeg_bin()
return ffmpeg
def convert(filename):
outfile = f'{filename}.wav'
if not os.path.isfile(outfile):
subprocess.run([ffmpeg_path(),
'-i', filename, outfile], capture_output=True)
print(outfile)
if __name__ == '__main__':
for line in fileinput.input():
convert(line.strip())