Vinlic / WebVideoCreator

🌈 A framework for rendering web animations into videos. It's implemented based on Node.js + Puppeteer + Chrome + FFmpeg, utilizing the latest browser APIs.
Apache License 2.0
94 stars 26 forks source link

`outputStream` instead of writing to file? #32

Open WofWca opened 2 weeks ago

WofWca commented 2 weeks ago

timecut has the outputStream option. I believe it is nice for when you want the users of your web service to start downloading the file immediately, as it is being rendered.


Or perhaps are there workarounds? I discovered that files are being written in the temp directory ./tmp/synthesizer/:

https://github.com/Vinlic/WebVideoCreator/blob/fb62279513ca0ac01f6b8864a1e43101cbc9532e/core/Synthesizer.js#L93

after which the file is simply moved

https://github.com/Vinlic/WebVideoCreator/blob/fb62279513ca0ac01f6b8864a1e43101cbc9532e/core/Synthesizer.js#L251

WofWca commented 2 weeks ago

I suppose the place to modify when adding this feature is

https://github.com/Vinlic/WebVideoCreator/blob/fb62279513ca0ac01f6b8864a1e43101cbc9532e/core/Synthesizer.js#L473

According to the docs, a stream can be passed instead of a file name