From 51fef324d895a0fcd4fcff168a71391c51e31062 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Wed, 20 Jun 2018 17:14:15 -0400 Subject: [PATCH] adjust tempDir param --- lib/index.js | 13 +------------ readme.md | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/lib/index.js b/lib/index.js index 24c95d9..43238eb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -6,18 +6,9 @@ const tempy = require('tempy') const initFrames = require('./init-frames') const renderFrames = require('./render-frames') const transcodeVideo = require('./transcode-video') -const crypto = require('crypto') -const path = require('path') -const fs = require('fs') const noop = () => { } -const createTempWorkingDirectory = (workingDir) => { - const dir = path.join(workingDir, crypto.randomBytes(Math.ceil(32 / 2)).toString('hex').slice(0, 32)) - fs.mkdirSync(dir) - return dir -} - module.exports = async (opts) => { const { log = noop, @@ -29,13 +20,11 @@ module.exports = async (opts) => { audio = undefined, videos, output, - workingDir + tempDir = tempy.directory() } = opts console.time(`ffmpeg-concat`) - const tempDir = workingDir ? createTempWorkingDirectory(workingDir) : tempy.directory() - try { console.time(`init-frames`) const { diff --git a/readme.md b/readme.md index 78a231b..b9d5507 100644 --- a/readme.md +++ b/readme.md @@ -193,13 +193,6 @@ The format for temporary frame images. You may, for example, use `png` or `jpg`. Note: the default is `raw` for performance reasons, as writing and reading raw binary pixel data is much faster than encoding and decoding `png` frames. Raw format is difficult to preview and debug, however, in which case you may want to change `frameFormat` to `png`. -##### cleanupFrames - -Type: `boolean` -Default: `true` - -By default, we cleanup temporary frame images. Set this to `false` if you need to debug intermediate results. - ##### concurrency Type: `Number` @@ -214,13 +207,19 @@ Default: `noop` Optional function to log progress and the underlying ffmpeg commands. You may, for example, use `console.log` -##### workingDir +##### cleanupFrames + +Type: `boolean` +Default: `true` + +By default, we cleanup temporary frame images. Set this to `false` if you need to debug intermediate results. + +##### tempDir Type: `string` -Default: `` +Default: random directory in `/tmp` -The working dir in which you want concat to work. e.g. /mnt/mine -if not provided, /tmp will be used as working directory +The temporary working directory to store intermediate frame data. This is where the frames in `cleanupFrames` will be saved. ## Transitions