Skip to content

Instantly share code, notes, and snippets.

@Sarjuuk
Last active April 24, 2023 22:21
Show Gist options
  • Save Sarjuuk/1f05ef2affe49a7e7ca0fad7b01c081d to your computer and use it in GitHub Desktop.
Save Sarjuuk/1f05ef2affe49a7e7ca0fad7b01c081d to your computer and use it in GitHub Desktop.
[*NIX] audio file conversion using ffmpeg - deletes after conversion
#!/bin/bash
find . -name "*.wav" | xargs -I % sh -c 'ffmpeg -hide_banner -y -i "%" -acodec libvorbis -f ogg "%_"; rm "%";' && find . -name "*.mp3" | xargs -I % sh -c 'ffmpeg -hide_banner -y -i "%" -acodec libmp3lame -f mp3 "%_"; rm "%";'
@Sarjuuk
Copy link
Author

Sarjuuk commented Mar 26, 2018

yeah, command was missing a -f ogg

@Helias
Copy link

Helias commented Jan 6, 2023

on mac I get find: illegal option -- n, I need to specificy the current directory adding . before -name to make it works like

#!/bin/bash
find . -name "*.wav" | xargs -I % sh -c 'ffmpeg -hide_banner -y -i "%" -acodec libvorbis -f ogg "%_"; rm "%";' && find . -name "*.mp3" | xargs -I % sh -c 'ffmpeg -hide_banner -y -i "%" -acodec libmp3lame -f mp3 "%_"; rm "%";'
``

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