lordmulder / LameXP

Audio Encoder Front-End
http://lordmulder.github.io/LameXP
Other
184 stars 18 forks source link

Estimated time left #20

Open xtemp09 opened 9 years ago

xtemp09 commented 9 years ago

Could you add an indicator that shows estimated time left?

I got used to set the highest quality; therefore, it takes a long while to convert. It would be easier to manage your time if you see how much time the program needs to finish the list.

lordmulder commented 9 years ago

Extrapolating the remaining time for a single file is straight forward: If the first x percent of the file completed in n seconds, then we can approximate the total time as n/x and thus the remaining time can be approximated as (n/x)-n. But LameXP rarely processes a single file. That's the point!

LameXP is optimized for batch processing, i.e. it will process multiple files. And it even processes several files in parallel (multi-threading). Of course we could simply say: If completing the first x of y files took n seconds, then completing all files will take approximately n/(x/y). But this will be an extremely coarse estimate, even if all files have (roughly) the same length. And if the files do not have the same length (which is the case more often than not), the estimate will simply be wrong and misleading.

The only way to do a "proper" estimate in the LameXP scenario would be to compute the accumulated length of all files in the list, before we start the encoding process - which yields the total amount of audio to be processed. And then, for every single update of the ETA, we would need to compute the accumulated length of the files that have already been completed plus the completed fraction of all files that are currently being processed - which yields the total amount of audio processed thus far.

While this is not totally impossible to implement, it would add a whole lot of complexity to the program. For a very little gain. So I don't see this happening any time soon...

xtemp09 commented 9 years ago

Actually, I expected something like the following:

Average Speed = Size of the files converted / Expended Time [Average Speed] = 1 Mb/s ETA = size of the files to convert / Average Speed

Coarse estimate is good if you convert a hundred files.

lordmulder commented 9 years ago

As explained before, computing a rough estimate of the ETA from the number of files completed so far (versus the number of files that are still left in the queue) could work, if and only if all your "hundred files" had the same length. But: As soon as your are converting files of different length – which will be the case more often than not – this kind of estimated ETA will simply be wrong and misleading.

I have already outlined how a "proper" solution would have to be implemented (keep track of the total amount of audio already processed vs. the total amount of audio that is still left) and why this won't happen anytime soon – if at all. Better show no ETA at all than fooling the user with an invalid ETA.


About estimating a files length (duration) from it's file size: For compressed audio files there is absolutely no relation between a file's size and its length (duration)! For example, if we have two audio files that are both exactly 10 MB in size, but one file is ~64 kbps (e.g. audio book) and one is ~320 kbps (classical music), then the first file has a duration of 22 minutes while the second file has a duration of 4.5 minutes. And the time required to re-encode a file is proportional (roughly) to its duration, not to its file size.