Meatgrinder/media_convert.py
2024-10-10 10:54:54 -04:00

13 lines
340 B
Python

import ffmpeg
import uuid
import pathlib
def process(input_media):
temp_dir = "./env/tmp"
pathlib.Path(temp_dir).mkdir(parents=True, exist_ok=True)
temp_name = temp_dir + str(uuid.uuid4()) + ".wav"
stream = ffmpeg.input(input_media)
stream = ffmpeg.output(stream, temp_name)
ffmpeg.run(stream)
return temp_name