diff --git a/background-music/encodeTo.sh b/background-music/encodeTo.sh index e80f4b3a..cd81cdf4 100755 --- a/background-music/encodeTo.sh +++ b/background-music/encodeTo.sh @@ -1,79 +1,79 @@ #!/bin/sh # First create a new directory (aac ac3 mp3) # Example for aac: # rsync -a --exclude .git backgroundMusic *.sh $aac # cd aac # ./encodeTo.sh if [ $# -ne 1 ] then echo "Usage $(basename $0) aac|ac3|mp3" exit 1 fi format=$1 encoder="avconv" if command -v avconv >/dev/null 2>&1; then echo "avconv found" if [ $format = "aac" ] then codec="libvo_aacenc" elif [ $format = "ac3" ] then codec="ac3" elif [ $format = "mp3" ] then codec="libmp3lame" else echo "Error, unsupported format $1" exit 1 fi elif command -v ffmpeg >/dev/null 2>&1; then echo "ffmpeg found" encoder="ffmpeg" if [ $format = "aac" ] then codec="aac" elif [ $format = "ac3" ] then codec="ac3" elif [ $format = "mp3" ] then codec="mp3" else echo "Error, unsupported format $1" exit 1 fi else echo "neither avconv nor ffmpeg found" exit 1 fi echo "Transcode ogg files to $format" for f in $(find . -type f -name \*.ogg) do #echo "Processing $f" $encoder -v warning -i $f -acodec $codec ${f%.*}.${format} if [ $? -ne 0 ] then echo "ERROR: Failed to convert $f" fi id3v2 -a "$(vorbiscomment --list $f | grep 'ARTIST' | cut -d '=' -f 2)" ${f%.*}.${format} id3v2 -t "$(vorbiscomment --list $f | grep 'TITLE' | cut -d '=' -f 2)" ${f%.*}.${format} id3v2 -y "$(vorbiscomment --list $f | grep 'DATE' | cut -d '=' -f 2)" ${f%.*}.${format} - id3v2 -c "$(vorbiscomment --list $f | grep 'COMMENTS' | cut -d '=' -f 2)" ${f%.*}.${format} + id3v2 --TCOP "$(vorbiscomment --list $f | grep 'COPYRIGHT' | cut -d '=' -f 2)" ${f%.*}.${format} rm -f $f done echo "Fix symlinks" for f in $(find . -type l -name \*.ogg) do #echo "Processing $f" target=$(readlink -f $f) rm $f ln -s -r ${target%.*}.${format} ${f%.*}.${format} done