mifi / editly

Slick, declarative command line video editing & API
MIT License
4.67k stars 299 forks source link

Make it a stateless/pure/functional component #3

Open mifi opened 4 years ago

mifi commented 4 years ago

Look into making it completely functional/stateless:

getFrame(frameNum, parameters) -> calculates transitions and everything to return a calculated frame

This allows for making a GUI with seeking to any random frame

Must have workaround for non-seekable streams like ffmpeg pipe

Also cache low resolution/low framerate version of each input video cut so we can render preview faster

mifi commented 3 years ago

I made a working statelessMode for the video frame source in https://github.com/mifi/editly/tree/stateless

However the hard part is to convert the main loop and its logic and state into a pure stateless function: https://github.com/mifi/editly/blob/ccd42cc2daa236114b288c44a35382b048ac720c/index.js#L436

mifi commented 3 years ago

I made a function https://github.com/mifi/editly/blob/fc2cb572fe9e2afc4e533537927d23379967d207/index.js#L372

...which will render a single frame at the specified time to a PNG. Useful for testing and could be useful in the future.

Example: renderSingleFrame.js

TODO:

mifi commented 3 years ago

Wow I just found this project which does exactly this: https://www.remotion.dev/