ffmpegwasm / ffmpegwasm/ffmpeg.wasm
`utils/parseProgress` doesn't always work as intended.
- Lingua principale
- C
- Stelle
- 17.8k
- Fork
- 1.1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**Describe the bug**
Progress ratio is wrong when concatenating 2 videos together
**To Reproduce**
Steps to reproduce the behavior:
1. set `setProgress`
2. use `filter_complex concat` (code sample link below)
**Expected behavior**
Ratio goes from 0-1
**Desktop (please complete the following information):**
- OS: MacOS 11.1
- Browser Chrome
- Version 88.0.4324.96
☝️ These are irrelevant
**Additional context**
Code sample is here: https://codepen.io/team/articulate/pen/RwobwBy
☝️ **Please use this gently!** This is a barebones example. It will only concat 2 videos of the same type. There's a whole lot of setup I gloss over here for the sake of making this example as simple as possible, but if you give it a few moments after load before using it, you should get a working example.
A few notes here as well:
1. Is there any reason to believe that outside of the `concat` filter, `utils/parseProgress` will be called with ` Duration` in the message more than once? (maybe with muxing video and audio, which I have not tested)
2. is there any reason why the `ratio` being added to the `progress` callback is being placed inside an object, instead of just a raw number being sent to the callback? The callback is never being called with anything else.
3. (related to note number 2) could the `progress callback` be called with `duration` when ` Duration` is sent, as well as a `time` property of the callback object, so that we might figure out our own information in these cases? For example, if I know I should expect 2 durations, I can then add them together:
```javascript
let duration = 0;
ffmpeg.setProgress(info => {
if (info.duration != null) {
duration += info.duration; // if I expect multiple durations, I can add them
}
if (info.time != null) {
const ratio = info.time / duration; // I can ignore `info.ratio` here, since I know it's wrong
doSomethingWith(ratio);
}
});
```
I'd be willing to rewrite `utils/parseProgress` to emit more information (while still maintaining its current functionality) if you need someone to do it.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.