Last active
January 29, 2024 14:34
-
-
Save Le0X8/cb5377ff3f9d6fcd92168a6fdd3763ce to your computer and use it in GitHub Desktop.
Mass converts entire directory of audio files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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