Skip to content

Instantly share code, notes, and snippets.

@Le0X8
Last active January 29, 2024 14:34
Show Gist options
  • Save Le0X8/cb5377ff3f9d6fcd92168a6fdd3763ce to your computer and use it in GitHub Desktop.
Save Le0X8/cb5377ff3f9d6fcd92168a6fdd3763ce to your computer and use it in GitHub Desktop.
Mass converts entire directory of audio files
const fs = require('fs');
const exec = require('child_process').execSync;
const files = fs.readdirSync('.').filter(f => f.endsWith('.wav'));
if (!fs.existsSync('./out')) fs.mkdirSync('./out');
files.forEach(file => exec('ffmpeg -i ' + file + ' -c:a libopus -ac 2 ./out/' + file.replace('.wav', '.webm'), {stdio: 'inherit'}));
console.log('########');
console.log('# DONE #');
console.log('########');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment