Meatgrinder/media_convert.py

13 lines
340 B
Python
Raw Normal View History

2024-10-10 14:51:48 +00:00
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