Created
April 6, 2024 12:03
-
-
Save greg-randall/a1b02ee046f50d47fa6f2e543ac04085 to your computer and use it in GitHub Desktop.
Convert a folder one m4b at a time to opus. Edit line 4 for more or less any file format that contains audio.
This file contains 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/bash | |
# Loop over all m4b files in the current directory | |
for input in *.m4b | |
do | |
# Print a message indicating the file being processed | |
echo "Processing file $input..." | |
# Use ffmpeg to convert the m4b file to a wav file | |
ffmpeg -i "$input" "${input%.*}.wav" | |
# Use opusenc to convert the wav file to an opus file | |
opusenc --downmix-mono --bitrate 32 --vbr "${input%.*}.wav" "${input%.*}.opus" | |
# Remove the wav file | |
rm "${input%.*}.wav" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment