git ssb

5+

Matt McKegg / ferment



Tree: ce8c9a23510ffcaae086aac41d0d04be17ab0af0

Files: ce8c9a23510ffcaae086aac41d0d04be17ab0af0 / lib / exec-ffmpeg.js

910 bytesRaw
1var extend = require('xtend')
2var Path = require('path')
3var ffmpeg = 'ffmpeg'
4var env = extend(process.env)
5
6if (process.platform === 'darwin') {
7 ffmpeg = Path.join(__dirname, '..', 'bin', 'ffmpeg-darwin')
8}
9
10if (process.platform === 'linux' && process.arch === 'x64') {
11 ffmpeg = Path.join(__dirname, '..', 'bin', 'ffmpeg-linux-x64')
12}
13
14console.log('using ', ffmpeg)
15
16var childProcess = require('child_process')
17
18module.exports = function (args, opts, cb) {
19 if (typeof opts === 'function') {
20 cb = opts
21 opts = null
22 }
23 childProcess.execFile(ffmpeg, args, extend({
24 env, maxBuffer: 1024 * 1024 * 16, encoding: 'buffer', cwd: process.cwd()
25 }, opts), cb)
26}
27
28module.exports.spawn = function (args, opts, cb) {
29 if (typeof opts === 'function') {
30 cb = opts
31 opts = null
32 }
33 return childProcess.spawn(ffmpeg, args, extend({
34 env, encoding: 'buffer', cwd: process.cwd()
35 }, opts))
36}
37

Built with git-ssb-web