From 6940427a6250acdfb596b6b525d6cb906c54abdf Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Fri, 30 May 2014 14:51:29 -0400 Subject: [PATCH] [multimedia] Add mp3car.sh Utility to convert audio files to low-quality MP3s. --- bin/mp3car | 1 + multimedia/README | 16 ++++++++++++++++ multimedia/mp3car.sh | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 120000 bin/mp3car mode change 100644 => 100755 multimedia/README create mode 100755 multimedia/mp3car.sh diff --git a/bin/mp3car b/bin/mp3car new file mode 120000 index 0000000..f0e16eb --- /dev/null +++ b/bin/mp3car @@ -0,0 +1 @@ +../multimedia/mp3car.sh \ No newline at end of file diff --git a/multimedia/README b/multimedia/README old mode 100644 new mode 100755 index 5967303..08ee4f2 --- a/multimedia/README +++ b/multimedia/README @@ -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. diff --git a/multimedia/mp3car.sh b/multimedia/mp3car.sh new file mode 100755 index 0000000..d79d4d2 --- /dev/null +++ b/multimedia/mp3car.sh @@ -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 [...]]" + 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