Skip to content

Instantly share code, notes, and snippets.

@revolunet
Last active November 15, 2022 14:25
Show Gist options
  • Save revolunet/d135a8a1c36ef27064e5 to your computer and use it in GitHub Desktop.
Save revolunet/d135a8a1c36ef27064e5 to your computer and use it in GitHub Desktop.
MP3 and WAV to OGG VORBIS using VLC CLI
#!/bin/sh
#
# Convert a bunch of mp3|wav files to ogg
#
VLC="/Applications/VLC.app/Contents/MacOS/VLC"
for file in "$@";
do
echo $file;
if [ -f "$file" ]
then
OUTPUT="${file/.mp3/.ogg}"
OUTPUT="${OUTPUT/.wav/.ogg}"
if [ ! -f "$OUTPUT" ]
then
echo "[+] converting $file to $OUTPUT"
$VLC -I dummy "$file" --sout="#transcode{acodec=vorb}:standard{access=file,mux=ogg,dst=$OUTPUT}" vlc://quit
else
echo "[-] $OUTPUT already exists, skip"
fi
else
echo "[-] USAGE : $0 filename.mp3"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment