From 39ac2b5f4972de41a13433a3e97e9833096d6fe9 Mon Sep 17 00:00:00 2001 From: Bauke Date: Sat, 10 Aug 2024 12:17:38 +0200 Subject: [PATCH] Add a to-mp3 function. --- .functions.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.functions.zsh b/.functions.zsh index 30a7f27..0d17bf5 100644 --- a/.functions.zsh +++ b/.functions.zsh @@ -61,3 +61,12 @@ to-opus () { ffmpeg -i "$input_file" -c:a libopus -b:a 128K "$output_file" done } + +# Converts any given files to 128K MP3 using ffmpeg. +# to-mp3 +to-mp3 () { + for input_file in "$@"; do + output_file="${input_file%.*}.mp3" + ffmpeg -i "$input_file" -map_metadata 0:s:a:0 -b:a 128K -y "$output_file" + done +}