Skip to content

Instantly share code, notes, and snippets.

@pofulu
Created August 2, 2020 09:22
Show Gist options
  • Select an option

  • Save pofulu/6286bc4d5ef7f2c9db01b8154bbead6c to your computer and use it in GitHub Desktop.

Select an option

Save pofulu/6286bc4d5ef7f2c9db01b8154bbead6c to your computer and use it in GitHub Desktop.
Audio to Spark AR (AppleScript - JXA)
const FFMPEG_PATH = 'usr/local/bin/ffmpeg';
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
const app = Application.currentApplication()
app.includeStandardAdditions = true
function openDocuments(droppedItems) {
const changeExtension = (file, newExtension) => file.substr(0, file.lastIndexOf(".")) + `.${newExtension}`;
droppedItems.forEach(file => {
const intput = file.toString();
const output = changeExtension(intput, 'm4a');
const cmd = `${FFMPEG_PATH} -i '${intput}' -b:a 128k -ar 44100 -ac 1 '${output}'`;
app.doShellScript(cmd);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment