File size: 426 Bytes
345855e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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