Spaces:
Running
Running
Commit
·
fabab2d
1
Parent(s):
616746e
FIX
Browse files- scripts/glitch.py +5 -4
scripts/glitch.py
CHANGED
|
@@ -107,6 +107,7 @@ def build_concat_raw(gif1: Path, gif2: Path, out_mp4: Path, fps: int, dur_total:
|
|
| 107 |
"-filter_complex", filter_complex,
|
| 108 |
"-map", "[v]",
|
| 109 |
"-r", str(F),
|
|
|
|
| 110 |
"-c:v", "libx264", "-pix_fmt", "yuv420p",
|
| 111 |
str(out_mp4)
|
| 112 |
]
|
|
@@ -248,14 +249,14 @@ def main():
|
|
| 248 |
ap.add_argument("duration", type=float, help="Total output duration in seconds (e.g., 8.0)")
|
| 249 |
ap.add_argument("--fps", type=int, default=60, help="Frames per second (default: 60)")
|
| 250 |
ap.add_argument("--base", type=Path, default=None, help="Output basename (default: image stem)")
|
| 251 |
-
ap.add_argument("--out", type=Path, default=None, help="
|
| 252 |
ap.add_argument("--glitch2_secs", type=float, default=2.0, help="Duration of heavy glitch segment (default: 2.0s)")
|
| 253 |
# Transition tuning
|
| 254 |
ap.add_argument("--wobble_main", type=float, default=0.008, help="Main wobble radians amplitude during transitions")
|
| 255 |
ap.add_argument("--wobble_jitter", type=float, default=0.002, help="Jitter wobble radians amplitude during transitions")
|
| 256 |
ap.add_argument("--wobble_f1", type=float, default=1.0, help="Wobble frequency 1 (Hz)")
|
| 257 |
ap.add_argument("--wobble_f2", type=float, default=1.0, help="Wobble frequency 2 (Hz)")
|
| 258 |
-
ap.add_argument("--
|
| 259 |
args = ap.parse_args()
|
| 260 |
|
| 261 |
img_path = args.image
|
|
@@ -278,7 +279,7 @@ def main():
|
|
| 278 |
gif2 = Path(f"{base}_glitch2.gif")
|
| 279 |
concat_raw = Path(f"{base}_raw.mp4")
|
| 280 |
vfx_mp4 = Path(f"{base}_vfx.mp4")
|
| 281 |
-
final_mp4 = args.
|
| 282 |
|
| 283 |
log(f"[SETUP] image={img_path} duration={duration}s fps={fps} glitch2_secs={glitch2_secs}s")
|
| 284 |
log(f"[PLAN] seg1(loop)={seg1_secs:.3f}s seg2(heavy)={seg2_secs:.3f}s")
|
|
@@ -306,7 +307,7 @@ def main():
|
|
| 306 |
add_transitions(vfx_mp4, final_mp4, fps=fps, dur_total=duration,
|
| 307 |
wobble_main=args.wobble_main, wobble_jitter=args.wobble_jitter,
|
| 308 |
wobble_f1=args.wobble_f1, wobble_f2=args.wobble_f2,
|
| 309 |
-
blur_sigma=args.
|
| 310 |
|
| 311 |
log("[DONE]")
|
| 312 |
log(f" - GIF 1: {gif1}")
|
|
|
|
| 107 |
"-filter_complex", filter_complex,
|
| 108 |
"-map", "[v]",
|
| 109 |
"-r", str(F),
|
| 110 |
+
"-t", str(dur_total),
|
| 111 |
"-c:v", "libx264", "-pix_fmt", "yuv420p",
|
| 112 |
str(out_mp4)
|
| 113 |
]
|
|
|
|
| 249 |
ap.add_argument("duration", type=float, help="Total output duration in seconds (e.g., 8.0)")
|
| 250 |
ap.add_argument("--fps", type=int, default=60, help="Frames per second (default: 60)")
|
| 251 |
ap.add_argument("--base", type=Path, default=None, help="Output basename (default: image stem)")
|
| 252 |
+
ap.add_argument("--out", type=Path, default=None, help="Output filename")
|
| 253 |
ap.add_argument("--glitch2_secs", type=float, default=2.0, help="Duration of heavy glitch segment (default: 2.0s)")
|
| 254 |
# Transition tuning
|
| 255 |
ap.add_argument("--wobble_main", type=float, default=0.008, help="Main wobble radians amplitude during transitions")
|
| 256 |
ap.add_argument("--wobble_jitter", type=float, default=0.002, help="Jitter wobble radians amplitude during transitions")
|
| 257 |
ap.add_argument("--wobble_f1", type=float, default=1.0, help="Wobble frequency 1 (Hz)")
|
| 258 |
ap.add_argument("--wobble_f2", type=float, default=1.0, help="Wobble frequency 2 (Hz)")
|
| 259 |
+
ap.add_argument("--blur", type=int, default=6, help="Gaussian blur sigma during transitions")
|
| 260 |
args = ap.parse_args()
|
| 261 |
|
| 262 |
img_path = args.image
|
|
|
|
| 279 |
gif2 = Path(f"{base}_glitch2.gif")
|
| 280 |
concat_raw = Path(f"{base}_raw.mp4")
|
| 281 |
vfx_mp4 = Path(f"{base}_vfx.mp4")
|
| 282 |
+
final_mp4 = args.base or Path(f"{base}_final.mp4")
|
| 283 |
|
| 284 |
log(f"[SETUP] image={img_path} duration={duration}s fps={fps} glitch2_secs={glitch2_secs}s")
|
| 285 |
log(f"[PLAN] seg1(loop)={seg1_secs:.3f}s seg2(heavy)={seg2_secs:.3f}s")
|
|
|
|
| 307 |
add_transitions(vfx_mp4, final_mp4, fps=fps, dur_total=duration,
|
| 308 |
wobble_main=args.wobble_main, wobble_jitter=args.wobble_jitter,
|
| 309 |
wobble_f1=args.wobble_f1, wobble_f2=args.wobble_f2,
|
| 310 |
+
blur_sigma=args.blur)
|
| 311 |
|
| 312 |
log("[DONE]")
|
| 313 |
log(f" - GIF 1: {gif1}")
|