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

Progress value does not update correctly #112

Closed
zandercodes opened this issue Nov 17, 2020 · 8 comments · Fixed by #139
Closed

Progress value does not update correctly #112

zandercodes opened this issue Nov 17, 2020 · 8 comments · Fixed by #139
Labels
bug Something isn't working

Comments

@zandercodes
Copy link

Describe the bug
The progress is updated only at the beginning of the convert and at the end so the ratio is 0 or 1 and no float.

To Reproduce
Steps to reproduce the behavior:

  1. setProgress()
  2. setProgress Temp console out.

Expected behavior
It should be normal to update the progress of the conversion so that you can do something with the ratio.

Desktop (please complete the following information):

  • OS: Windows 8.1 (Build 9600)
  • Browser: Chrome
  • Version: 86.0.4240.198 [64-Bit]
@DavideVito
Copy link

same here, i get strange values, over 100% or -415449691.446%

@jeromewu
Copy link
Collaborator

Can you provide minimal code base and video file to reproduce this issue?
Also if you are interested, you can check how progress is generated here: https://github.com/ffmpegwasm/ffmpeg.wasm/blob/master/src/utils/parseProgress.js

@sps014
Copy link

sps014 commented Nov 20, 2020

Same Issue, I am also getting progress at end of Conversion as 1, no floating values.
I used Conversion from mp4 to mp3,
code

progress({ ratio: t / duration });

is not triggered for some strange reasons.

@sps014
Copy link

sps014 commented Nov 20, 2020

I think this scenario is not handled ,i tried converting mp4 video to mp3 with following config on website,
https://ffmpegwasm.github.io/#demo
you can see the progress bar not updating.

{
  args: ['-i', 'vid.mp4','audio.mp3'],
  inFilename: 'vid.mp4',
  outFilename: 'audio.mp3',
  mediaType: 'audio/mp3',
}

@jeromewu jeromewu added the bug Something isn't working label Nov 26, 2020
@colecrouter
Copy link

Can confirm. Spent an hour trying to figure out what I was doing wrong. I was doing mp4 to mp3 as well. { ratio: 1 } after all the transcoding is done, and nothing more.

@lamaland
Copy link
Contributor

Same issue here, converting wav file to mp3, tried both :

const ffmpeg = createFFmpeg({
  progress: (params) => console.log(params),
})
const transcode = async (file: File) => {
  const { name } = file
  await ffmpeg.load()
  ffmpeg.FS('writeFile', name, await fetchFile(file))
  await ffmpeg.run('-i', name, 'output.mp3')
  const data = ffmpeg.FS('readFile', 'output.mp3')
  return data.buffer
}

and

const ffmpeg = createFFmpeg()
const transcode = async (file: File) => {
  const { name } = file
  await ffmpeg.load()
  await ffmpeg.setProgress((p) => console.log(p))
  ffmpeg.FS('writeFile', name, await fetchFile(file))
  await ffmpeg.run('-i', name, 'output.mp3')
  const data = ffmpeg.FS('readFile', 'output.mp3')
  return data.buffer
}

Just receiving a final update with a "1" ratio.
image

Thanks for hard work! Hope this could help.

@lamaland
Copy link
Contributor

Hum, ok i think i get it!

@jeromewu, I took a look at https://github.com/ffmpegwasm/ffmpeg.wasm/blob/master/src/utils/parseProgress.js

Progress is working well with avi to mp4 encoding.
ffmpeg.run('-i', name, 'output.mp4')

image

Progress is not working with lame encoder :
image

Pretty sure more case handling are needed here, in this specific part of progress code :
image

@lamaland
Copy link
Contributor

Cloned project, tested with:
image
Seems to fix the issue.
May I push a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants