basyx commited on
Commit
d4faba0
·
verified ·
1 Parent(s): fe0cb26

Create normalizer.py

Browse files
Files changed (1) hide show
  1. ingestion/normalizer.py +24 -0
ingestion/normalizer.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import uuid
3
+ import os
4
+
5
+ def normalize_video(path):
6
+
7
+ output = f"jobs/norm_{uuid.uuid4()}.mp4"
8
+
9
+ cmd = [
10
+ "ffmpeg",
11
+ "-y",
12
+ "-i", path,
13
+ "-vf", "scale=1080:-2",
14
+ "-c:v", "libx264",
15
+ "-preset", "veryfast",
16
+ "-crf", "23",
17
+ "-c:a", "aac",
18
+ "-movflags", "+faststart",
19
+ output,
20
+ ]
21
+
22
+ subprocess.run(cmd, check=True)
23
+
24
+ return output