Skip to content

Instantly share code, notes, and snippets.

@SyBen
Last active January 4, 2016 02:59
Show Gist options
  • Save SyBen/8558704 to your computer and use it in GitHub Desktop.
Save SyBen/8558704 to your computer and use it in GitHub Desktop.
converts all the flac files from a directory to 320kbps mp3 files in a new directory.
#!/bin/bash
#License CC-BY-NC-SA for the code.
#This script converts all flac files in a directory into 320kpbs mp3 files, and then move them into another directory,
#set as the first argument. The occurences of words Flac and FLAC will be replace in the name of the working director.y
#considering wd is /path/nameOfDirectory-FLAC, the new directory will be $1/nameOfDirectory-mp3.
#Needs 1 parameter : the path to save the directory containing the mp3 files.
var2=`pwd`
var1=${var2##*/}
var=${var1//FLAC|Flac/mp3}
for f in *.flac; do ffmpeg -i "$f" -ab 320k "${f%.flac}.mp3"; done
mkdir "$var"
mv *.mp3 "$var"
mv "$var" $1
@AlexandreRio
Copy link

See my fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment