ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
14.4k stars 845 forks source link

parseProgress returns the wrong duration depending of the order of multiple inputs and image inputs #466

Closed sylvain-reynaud closed 1 year ago

sylvain-reynaud commented 1 year ago

Describe the bug parseProgress (here) returns the wrong duration depending of the order of multiple inputs.

For example, 2 input files are given to ffmpeg, if the 1st input has a duration, then this duration is returned by parseProgress. The bug happens when the 1st file is an image, the duration given by ffmpeg is 00:00:00:04, so the progress ratio calculation is based on 00:00:00:04.

To Reproduce Steps to reproduce the behavior:

  1. Set setProgress,
  2. Run a command with 2 inputs: 1 image and 1 audio

Expected behavior ratio returned here is supposed to be float between 0 and 1 that gives the progress of the run.

Desktop (please complete the following information):

Additional context Console logs Test app: https://image-plus-audio-9g1l4hk4p-sylvain-reynaud.vercel.app/ Code app: https://github.com/sylvain-reynaud/image-plus-audio/blob/b7329a1dcb12f07106a505268956ceaf089a28aa/src/routes/GenerateVideoButton.svelte#L12

Possible solution Check if d >= 1 here to skip image durations.