Last active
November 15, 2022 14:25
-
-
Save revolunet/d135a8a1c36ef27064e5 to your computer and use it in GitHub Desktop.
MP3 and WAV to OGG VORBIS using VLC CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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