1
Fork 0
mirror of https://github.com/thegeneralist01/social-media-video-downloader-bot synced 2026-03-07 12:29:55 +01:00

use all cores + postprocessor args

This commit is contained in:
TheGeneralist 2025-04-04 18:43:45 +02:00
parent 71ad4861bc
commit b8214e5a12
No known key found for this signature in database
GPG key ID: C391D4D52D630F45

View file

@ -4,17 +4,19 @@ use anyhow::Result;
use teloxide::types::UserId;
pub async fn download(url: &str, user_id: UserId) -> Result<bool> {
// The command I use:
// yt-dlp "https://www.youtube.com/watch?v=$1" -o "$2" --merge-output-format mp4
let cmd = Command::new("yt-dlp")
.arg(url)
.arg("-o")
// .arg("%(title).90s.%(ext)s")
.arg(format!("./downloads/{}.%(ext)s", user_id))
.arg("--merge-output-format")
.arg("mp4")
.arg("--concurrent-fragments")
.arg("12")
.arg("--postprocessor-args")
.arg("ffmpeg:-c:v libx264 -profile:v high -preset veryfast -b:v 4133k -bufsize 8266k -maxrate 4500k -r 60 -c:a aac -b:a 128k -threads 12")
.output()
.expect("Failed to execute command");
log::debug!("yt-dlp output: {:?}", cmd);
Ok(cmd.status.success())
}