[multimedia] Add mp3car.sh

Utility to convert audio files to low-quality MP3s.
This commit is contained in:
Matteo Cypriani 2014-05-30 14:51:29 -04:00
parent 9d58956e77
commit 6940427a62
3 changed files with 53 additions and 0 deletions

1
bin/mp3car Symbolic link
View File

@ -0,0 +1 @@
../multimedia/mp3car.sh

16
multimedia/README Normal file → Executable file
View File

@ -101,3 +101,19 @@ Invocation du script :
On spécifie ensuite un ou plusieurs fichier sur lequel ou lesquels
effectuer l'action.
# mp3car.sh #
mp3car.sh uses the pacpl (Perl Audio Converter) multi-purpose audio
converter to convert audio files in any format to low-quality MP3s
suitable for listening in a car. The goal is to maximise the number of
albums that can be contained in a CD-ROM (or USB stick). The default
encoding parameters are variable bitrate (VBR) from 32 to 128 kbps, in
joint stereo.
Usage: just call the script with one or more files or directories, and
they will be converted recursively and put in the target directory
(~/tmp/mp3car/ by default, edit the script to change that).
You must have installed pacpl and lame for this script to work.

36
multimedia/mp3car.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
#
# mp3car.sh, Copyright © 2014 Matteo Cypriani
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
# This script uses pacpl (Perl Audio Converter) to convert any audio
# files to low-quality MP3, suitable for listening in a car (default
# parameters are VBR 32-128 kbps, joint stereo).
#
# Dependencies: pacpl, lame
if [ $# -lt 1 ] ; then
echo "Usage: $0 <input> [input [...]]"
exit 1
fi
BASEOUTDIR="$HOME/tmp/mp3car"
LAMEOPTIONS="-v -b 32 -B 128"
for INPUT in "$@" ; do
echo
echo "*** CONVERTING \"$INPUT\" ***"
OUTDIR="$BASEOUTDIR/$(basename "$INPUT")"
echo "Destination directory: \"$OUTDIR\""
echo
mkdir -p "$OUTDIR"
pacpl \
--to mp3 --encoder lame --defopts 0 --eopts "$LAMEOPTIONS" \
--recursive --preserve --outdir "$OUTDIR" \
"$INPUT"
done