Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. const async = require('async')
  2. const path = require('path')
  3. const spawn = require('child_process').spawn
  4.  
  5. const CONCURRENCY = 6
  6.  
  7. const VIDEO_STORE_ROOT = 'K:'
  8. const VJ_VIDEO_STORE = 'Motion Graphics (VJ, Hap)'
  9.  
  10. const sources = require('yargs').argv._
  11.  
  12. function convertForVJ(source_filepath, callback) {
  13. let target_dir = path.join(VIDEO_STORE_ROOT, VJ_VIDEO_STORE)
  14. let target_filename = path.basename(source_filepath, path.extname(source_filepath)) + '.mov'
  15. let target_filepath = path.join(target_dir, target_filename)
  16. spawn('ffmpeg', [
  17. '-i', source_filepath, '-y', '-hide_banner',
  18. '-f', 'mov',
  19. '-c:v', 'hap', '-aspect', '16:9', '-s', '1280x720',
  20. '-an',
  21. target_filepath
  22. ], { stdio: ['ignore', 1, 2] }).on('close', () => { callback(null, source_filepath) })
  23. }
  24.  
  25. let queue = async.queue((filepath, callback) => {
  26. async.waterfall([
  27. function (done) { convertForVJ(filepath, done) }
  28. ], function (err) {
  29. if (!err) { console.error(err) }
  30. callback()
  31. })
  32. }, CONCURRENCY)
  33.  
  34. queue.push(sources)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement