From 60867fb030bae582082340ead7dbc7efdc2f5398 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Fri, 3 Apr 2020 02:37:42 -0700 Subject: 2020/04/03, 02:34, v1.2.0 --- node_modules/ffmpeg-static/example.js | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 node_modules/ffmpeg-static/example.js (limited to 'node_modules/ffmpeg-static/example.js') diff --git a/node_modules/ffmpeg-static/example.js b/node_modules/ffmpeg-static/example.js new file mode 100644 index 0000000..b26a51a --- /dev/null +++ b/node_modules/ffmpeg-static/example.js @@ -0,0 +1,36 @@ +#!/usr/bin/env node +'use strict' + +const {join} = require('path') +const shell = require('any-shell-escape') +const {exec} = require('child_process') + +const argv = process.argv.slice(2) +if (argv.includes('-h') || argv.includes('--help')) { + console.info(` +This is just a simple CLI wrapper around the powerful ffmpeg CLI tool. +This script just showcases how to use ffmpeg-static; It wouldn't make +sense to hide a flexible tool behind a limited wrapper script. +Usage: + ./example.js src-audio-file.m4a dest-audio-file.mp3 +`) + process.exit(0) +} + +const [src, dest] = argv +const makeMp3 = shell([ + 'ffmpeg', '-y', '-v', 'error', + '-i', join(process.cwd(), src), + '-acodec', 'mp3', + '-format', 'mp3', + join(process.cwd(), dest) +]) + +exec(makeMp3, (err) => { + if (err) { + console.error(err) + process.exit(1) + } else { + console.info('done!') + } +}) -- cgit v1.2.3