Skip to content

Commit

Permalink
adjust tempDir param
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Jun 20, 2018
1 parent b138bdb commit 51fef32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
13 changes: 1 addition & 12 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
21 changes: 10 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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

Expand Down

0 comments on commit 51fef32

Please sign in to comment.