mp3 converting with ffmpeg works
This commit is contained in:
parent
c8f9972941
commit
550c27ff03
2 changed files with 7 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue