diff --git a/src/dl/ffmpeg.rs b/src/dl/ffmpeg.rs index 1bdd2af..5e7d7d1 100644 --- a/src/dl/ffmpeg.rs +++ b/src/dl/ffmpeg.rs @@ -19,6 +19,7 @@ impl FFMpeg { output_path: &str, bitrate: u16, ) -> Result<(), SpawnError> { + let bitrate = format!("{}k", bitrate); let output = spawn( "ffmpeg", [ @@ -27,7 +28,7 @@ impl FFMpeg { "-codec:a", "libmp3lame", "-b:a", - "32k", + bitrate.as_str(), output_path, ], ) @@ -54,4 +55,4 @@ mod tests { assert_eq!(FFMpeg::round_mp3_bitrate(319.4), 320); assert_eq!(FFMpeg::round_mp3_bitrate(999.99), 320); } -} \ No newline at end of file +} diff --git a/src/main.rs b/src/main.rs index f38810a..b232435 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,6 +53,10 @@ async fn main() -> anyhow::Result<()> { println!("abr {}", FFMpeg::round_mp3_bitrate(129.492)); + FFMpeg::convert_to_mp3("audio.m4a", "audio.mp3", 160) + .await + .expect("convert"); + Ok(()) //bot_main().await }