From b8214e5a12cd1d8e4579becd57e13361b79fbd21 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Fri, 4 Apr 2025 18:43:45 +0200 Subject: [PATCH] use all cores + postprocessor args --- src/youtube.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/youtube.rs b/src/youtube.rs index fb951b1..5a743cc 100644 --- a/src/youtube.rs +++ b/src/youtube.rs @@ -4,17 +4,19 @@ use anyhow::Result; use teloxide::types::UserId; pub async fn download(url: &str, user_id: UserId) -> Result { - // 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()) }