| import subprocess | |
| import uuid | |
| import os | |
| def normalize_video(path): | |
| output = f"jobs/norm_{uuid.uuid4()}.mp4" | |
| cmd = [ | |
| "ffmpeg", | |
| "-y", | |
| "-i", path, | |
| "-vf", "scale=1080:-2", | |
| "-c:v", "libx264", | |
| "-preset", "veryfast", | |
| "-crf", "23", | |
| "-c:a", "aac", | |
| "-movflags", "+faststart", | |
| output, | |
| ] | |
| subprocess.run(cmd, check=True) | |
| return output |