mattdesl / canvas-sketch

[beta] A framework for making generative artwork in JavaScript and the browser.
MIT License
5.01k stars 393 forks source link

Sometimes ffmpeg exits early #115

Closed mattdesl closed 2 years ago

mattdesl commented 3 years ago

Some users report an error like this:

(node:15256) UnhandledPromiseRejectionWarning: Error: FFmpeg exited with status 1
    at ChildProcess.<anonymous> (C:\Users\amy\AppData\Roaming\npm\node_modules\canvas-sketch-cli\src\ffmpeg-sequence.js:269:23)
    at ChildProcess.emit (events.js:311:20)
    at ChildProcess.cp.emit (C:\Users\amy\AppData\Roaming\npm\node_modules\canvas-sketch-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
(node:15256) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:15256) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Working on some changes that might help debug this a bit better.

mattdesl commented 3 years ago

Update: this seems to be a mixture of two issues - 1 is that ffmpeg logs are hidden by default, so it's difficult to debug, and 2 is that odd size dimensions can crash ffmpeg (for some reason, only after a hundred or so frames are buffered into the mp4). The fix for now is to use even dimensions (e.g. 512x512) for video. You can also use FFMPEG_DEBUG=1 env var though it's more difficult to set on Windows.

Should probably do an overhaul of the ffmpeg and middleware utils with some new considerations, async syntax, etc.

mattdesl commented 2 years ago

I think this might be fixed in latest version. Please update and comment if you see it again.

If you've previously installed the CLI tool globally:

npm install canvas-sketch-cli@latest --global

Or locally:

npm install canvas-sketch-cli@latest --save-dev

Let me know if any issues persist.