Skip to content

Instantly share code, notes, and snippets.

@coreymwamba
Last active February 20, 2019 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymwamba/4952d7c937e6dabbbfb0e6cb6acc2379 to your computer and use it in GitHub Desktop.
Save coreymwamba/4952d7c937e6dabbbfb0e6cb6acc2379 to your computer and use it in GitHub Desktop.
Bash, inotify, FFMpeg script to convert audio files to a desired format by placing it in a folder. The example below is for Ogg Vorbis; change it to whatever you want. Then set the script to autostart (in DE or WM).
convert_ogg() {
ffmpeg -hide_banner -nostats -loglevel panic -i ~/audio/convert_to_ogg/$file -vn -b:a 320k ~/audio/convert_to_ogg/${file%.*}.flac &
echo "converting $file"
}
while true; do
inotifywait -m ~/audio/convert_to_ogg -e create -e moved_to | while read path action file; do
if [ ${file##*.} != "ogg" ]; then
convert_ogg
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment