Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: people / fr33domlover /

all2ogg.sh

#!/bin/bash

# [[!meta description="Audio file mass-converter"]]
# [[!tag /scripts]]

# TODO:
# - consider making this in Python like delpic and maybe also combine it with delpic
# - add support for getopt and the following options
# - verbose option which is like now, and regular mode which is just 1 output line per file
# - quiet, which cancels all output
# - set or add input file patterns

if [ -z $1 ]; then

cat << EOF
Usage: all2ogg.sh <dirpath>

This script finds recursively all the supported audio files (which aren't OGG)
under the directory given as an argument, and converts them into OGG files
with the same name but with '.ogg' extension. It uses 'avconv', but can probably
use 'ffmpeg' too.

EOF

else

input_list=`mktemp .list.XXXX`
find $1 \(                     \
          -type f -and         \
          \(                   \
            -name '*.mp3' -or  \
            -name '*.wma' -or  \
            -name '*.flac' -or \
            -name '*.m4a' -or  \
            -name '*.wav'      \
          \)                   \
        \)                     \
        > $input_list

while read input_file; do
	output_file=`echo "$input_file" | sed s/\\\.[^.]\\\+$/.ogg/`
	avconv -y -loglevel info -i "$input_file" -c:a libvorbis -q:a 5 "$output_file"
done < $input_list

rm $input_list

fi

[See repo JSON]