Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Progress of Editly #196

Open
liamcharmer opened this issue May 2, 2022 · 6 comments
Open

Get Progress of Editly #196

liamcharmer opened this issue May 2, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@liamcharmer
Copy link

Is there a simple way to get the progress of the editly running?

@mifi
Copy link
Owner

mifi commented May 2, 2022

unfortunately not, but it should be possible to implement some onProgress function

@atulmy
Copy link

atulmy commented Jun 19, 2022

That would be quite useful to show end user percentage completion of rendering a video.

@mifi mifi added the enhancement New feature or request label Jun 26, 2022
@twicer-is-coder
Copy link

Really need the on-progress event.

@wisekaa03
Copy link
Contributor

wisekaa03 commented Jul 8, 2022

Also possible:

...
        const outPath = await new Promise<string | Error>((resolve, reject) => {
          const childEditly = child.fork(
            'node_modules/.bin/editly',
            ['--json', editlyPath],
            {
              silent: true,
            },
          );
          childEditly.stdout?.on('data', (message: Buffer) => {
            const msg = message.toString();
            this.logger.debug(
              `Editly on '${renderEditor.id}' / '${renderEditor.name}': ${msg}`,
              'Editly',
            );
            const percent = msg.match(/(\d+%)/g);
            if (Array.isArray(percent) && percent.length > 0) {
              this.editorRepository
                .update(renderEditor.id, {
                  renderingPercent: parseInt(percent[percent.length - 1], 10),
                })
                .catch((error: any) => {
                  this.logger.error(error?.message, error?.stack, 'Editly');
                });
            }
          });
          childEditly.stderr?.on('data', (message: Buffer) => {
            const msg = message.toString();
            this.logger.debug(msg, undefined, 'Editly');
          });
          childEditly.on('error', (error: Error) => {
            this.logger.error(error.message, error.stack, 'Editly');
            reject(error);
          });
          childEditly.on(
            'exit',
            (/* code: number | null, signal: NodeJS.Signals | null */) => {
              resolve(editlyConfig.outPath);
            },
          );
        });
...

@twicer-is-coder
Copy link

renderEditor

Maybe wrap into a proper function like passing JSON object etc. Just make a wrapper function for it. It will help others a lot. With this approach, you can use the event emitter as well when creating a wrapper.

@SaadBazaz
Copy link

ffmpeg shows how many frames have been rendered in stdout.
ffmpeg-probes tells how many frames the video contains.

So a simple ratio of them can be the progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants