51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
|
import subprocess
|
||
|
import os
|
||
|
from rich.console import Console
|
||
|
from rich.panel import Panel
|
||
|
|
||
|
console = Console()
|
||
|
|
||
|
# Display header
|
||
|
subprocess.run(['toilet', '-f', 'smslant', 'DREADFUL LINK2MP4', '--gay'])
|
||
|
|
||
|
console.print(Panel("[bold green]Credits: Klez A.K.A Boomer", title="Credits"))
|
||
|
|
||
|
url = input("Enter the video URL: ").strip()
|
||
|
compressed_file = input("Enter the name for the compressed file (without .mp4): ").strip()
|
||
|
|
||
|
# Ensure the filename ends with '.mp4'
|
||
|
if not compressed_file.lower().endswith('.mp4'):
|
||
|
compressed_file += '.mp4'
|
||
|
|
||
|
download_file = "video.mp4"
|
||
|
|
||
|
try:
|
||
|
console.print(f"[bold blue]Downloading video from {url}...", style="bold cyan")
|
||
|
subprocess.run(['yt-dlp', '-f', 'mp4', url, '-o', download_file], check=True)
|
||
|
|
||
|
console.print("[bold yellow]Compressing video to approximately 14MB...", style="bold cyan")
|
||
|
subprocess.run(
|
||
|
['ffmpeg', '-i', download_file, '-b:v', '500k', '-c:a', 'aac', '-b:a', '64k', '-preset', 'medium', '-pass', '1', '-f', 'mp4', '/dev/null'],
|
||
|
check=True
|
||
|
)
|
||
|
subprocess.run(
|
||
|
['ffmpeg', '-i', download_file, '-b:v', '500k', '-c:a', 'aac', '-b:a', '64k', '-preset', 'medium', '-pass', '2', compressed_file],
|
||
|
check=True
|
||
|
)
|
||
|
|
||
|
finally:
|
||
|
# Cleanup temporary files
|
||
|
if os.path.exists(download_file):
|
||
|
os.remove(download_file)
|
||
|
console.print(f"[bold red]Removed temporary file: {download_file}", style="bold cyan")
|
||
|
|
||
|
# Cleanup FFmpeg temporary files
|
||
|
for log_file in ['ffmpeg2pass-0.log', 'ffmpeg2pass-0.log.mbtree']:
|
||
|
if os.path.exists(log_file):
|
||
|
os.remove(log_file)
|
||
|
console.print(f"[bold red]Removed temporary file: {log_file}", style="bold cyan")
|
||
|
|
||
|
# Final output message
|
||
|
if os.path.exists(compressed_file):
|
||
|
console.print(f"[bold green]Final output file: {compressed_file}", style="bold cyan")
|