digidau commited on
Commit
b53a3d3
·
verified ·
1 Parent(s): 4557f5a

Update background.py

Browse files
Files changed (1) hide show
  1. background.py +13 -8
background.py CHANGED
@@ -19,29 +19,34 @@ def generate_background(images, output_path):
19
  "-y",
20
  "-loop", "1",
21
  "-i", img,
 
22
  "-vf",
23
  (
24
- # 1. Scale awal sedikit lebih besar untuk supersampling agar tidak pecah saat dillebarkan
25
- "scale=1920:1080:force_original_aspect_ratio=increase,"
26
- "crop=1920:1080,"
27
 
28
- # 2. Filter zoompan yang sudah diperbaiki
29
  "zoompan="
30
  "z='max(1.0,1.15-(0.15*on/210))':"
31
- "x='trunc(iw/2-(iw/zoom/2))':" # Menggunakan trunc() untuk membulatkan koordinat x
32
- "y='trunc(ih/2-(ih/zoom/2))':" # Menggunakan trunc() untuk membulatkan koordinat y
33
  "d=210:"
34
- "s=1920x1080:"
35
  "fps=30"
36
  ),
 
37
  "-t", "7",
 
38
  "-r", "30",
 
39
  "-c:v", "libx264",
40
  "-pix_fmt", "yuv420p",
41
- temp_video
 
42
  ]
43
 
44
 
 
45
  subprocess.run(cmd, check=True)
46
 
47
  # satu gambar
 
19
  "-y",
20
  "-loop", "1",
21
  "-i", img,
22
+
23
  "-vf",
24
  (
25
+ # 1. UPSCALING: Paksa gambar 1080p naik ke 4K (3840x2160) agar FFmpeg punya extra pixel untuk kalkulasi
26
+ "scale=3840:2160,"
 
27
 
28
+ # 2. ZOOMPAN: Lakukan proses zoom di atas kanvas 4K ini
29
  "zoompan="
30
  "z='max(1.0,1.15-(0.15*on/210))':"
31
+ "x='iw/2-(iw/zoom/2)':"
32
+ "y='ih/2-(ih/zoom/2)':"
33
  "d=210:"
34
+ "s=1920x1080:" # 3. DOWNSCALING: Output akhir dikembalikan dengan mulus ke 1080p
35
  "fps=30"
36
  ),
37
+
38
  "-t", "7",
39
+
40
  "-r", "30",
41
+
42
  "-c:v", "libx264",
43
  "-pix_fmt", "yuv420p",
44
+
45
+ temp_video
46
  ]
47
 
48
 
49
+
50
  subprocess.run(cmd, check=True)
51
 
52
  # satu gambar