From 618f657d4b9c73092873b70c3fb4c8e8dc97570d Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 10 Nov 2022 21:15:10 +0100 Subject: [PATCH] [scripts] feat: convert audio files to ogg --- .local/bin/oggconv | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 .local/bin/oggconv diff --git a/.local/bin/oggconv b/.local/bin/oggconv new file mode 100755 index 0000000..56f74fc --- /dev/null +++ b/.local/bin/oggconv @@ -0,0 +1,23 @@ +#!/usr/bin/env sh + +# Author: Simon Legner + +convert () { + ffmpeg -i "$in" \ + -acodec libvorbis -aq 6 -vn -ac 2 \ + -map_metadata 0 \ + "$out" +} + +if [ "" = "$1" ]; then + echo Converts audio files to Ogg Vorbis using ffmpeg. + echo Usage: $0 file1.ext1 file2.ext2 ... fileN.ext4 + echo ... produces file1.ogg file2.ogg ... fileN.ogg +fi + +for i in "$@"; do + in="$1" + ext="$(basename "$in" | sed -e 's/.*\.//')" + out="${in%.$ext}.ogg" + convert +done