biohazard-vfx/public/projects/optimize_videos.py
Nicholai 11410f9727 Initial project setup with Next.js, Tailwind CSS, TypeScript, and ESLint configuration
- Configured Next.js app with app router
- Set up Tailwind CSS with custom dark theme
- Implemented providers with SessionProvider and ThemeProvider
- Added toast system
- Configured ESLint and Prettier
- Set up pre-commit hooks with husky and lint-staged

🚀 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <noreply@opencode.ai>
2025-08-07 15:33:04 -06:00

44 lines
1.3 KiB
Python

import os
import subprocess
from pathlib import Path
def main():
input_path = input("Enter the path to your input video: ").strip().strip('"')
output_folder = input("Enter the output folder path: ").strip().strip('"')
input_file = Path(input_path)
output_dir = Path(output_folder)
if not input_file.exists():
print("❌ Input file does not exist.")
return
if not output_dir.exists():
print("⚠️ Output folder does not exist. Creating it.")
output_dir.mkdir(parents=True, exist_ok=True)
output_path = output_dir / "video.mp4"
ffmpeg_cmd = [
"ffmpeg",
"-i", str(input_file),
"-c:v", "libx264",
"-preset", "slow", # balance between speed and file size
"-crf", "23", # quality (lower = better, ~18-28)
"-c:a", "aac",
"-b:a", "128k",
"-movflags", "+faststart", # for web streaming
"-pix_fmt", "yuv420p", # widest compatibility
str(output_path)
]
print(f"🎬 Converting {input_file.name}{output_path}")
subprocess.run(ffmpeg_cmd)
if output_path.exists():
print("✅ Conversion complete.")
else:
print("❌ Something went wrong during conversion.")
if __name__ == "__main__":
main()