Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const async = require('async')
- const path = require('path')
- const spawn = require('child_process').spawn
- const CONCURRENCY = 6
- const VIDEO_STORE_ROOT = 'K:'
- const VJ_VIDEO_STORE = 'Motion Graphics (VJ, Hap)'
- const sources = require('yargs').argv._
- function convertForVJ(source_filepath, callback) {
- let target_dir = path.join(VIDEO_STORE_ROOT, VJ_VIDEO_STORE)
- let target_filename = path.basename(source_filepath, path.extname(source_filepath)) + '.mov'
- let target_filepath = path.join(target_dir, target_filename)
- spawn('ffmpeg', [
- '-i', source_filepath, '-y', '-hide_banner',
- '-f', 'mov',
- '-c:v', 'hap', '-aspect', '16:9', '-s', '1280x720',
- '-an',
- target_filepath
- ], { stdio: ['ignore', 1, 2] }).on('close', () => { callback(null, source_filepath) })
- }
- let queue = async.queue((filepath, callback) => {
- async.waterfall([
- function (done) { convertForVJ(filepath, done) }
- ], function (err) {
- if (!err) { console.error(err) }
- callback()
- })
- }, CONCURRENCY)
- queue.push(sources)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement