Spaces:
Runtime error
Runtime error
| import os | |
| import uuid | |
| import ffmpeg | |
| TEMP_DIR = "temp_files" | |
| os.makedirs(TEMP_DIR, exist_ok=True) | |
| def save_file(upload_file, suffix): | |
| file_id = str(uuid.uuid4()) | |
| file_path = os.path.join(TEMP_DIR, f"{file_id}{suffix}") | |
| with open(file_path, "wb") as f: | |
| f.write(upload_file.read()) | |
| return file_path, file_id | |
| def process_video(video_path, overlay_path, output_path): | |
| ( | |
| ffmpeg | |
| .input(video_path) | |
| .overlay(overlay_path) | |
| .output(output_path) | |
| .run(overwrite_output=True) | |
| ) | |