sigal icon indicating copy to clipboard operation
sigal copied to clipboard

progress information for video rendering

Open anarcat opened this issue 8 years ago • 6 comments

it would be nice to have progress info when ffmpeg is running. it can take a loong time when compared with images, which makes me feel like sigal has hanged...

anarcat avatar Oct 25 '17 21:10 anarcat

Agreed, but it seems difficult as ffmpeg is run in a subprocess. Not sure how to get the progress status from ffmpeg, and then it needs some work on the Python side. And you cannot really know in advance how much time is needed for a given video, so how do you estimate the total time ?

saimn avatar Oct 28 '17 20:10 saimn

frankly, i have no idea. ;) I assume the click.ProgressBar thing now only estimates times based on the number of items?

just an idea: what if we would count file size instead? it may be off the mark because it videos probably take more time per byte than images, but it would be a better metric to use...

you would need to pipe the file data into ffmpeg's stdin to be able to count those bytes though, and this could be a performance hit as well...

the other alternative would be to use some lsof hack to keep track of where in the file ffmpeg is at... messy.

or you could parse ffmpeg output - maybe there's a standardized dialect there that it can yield that could be used?

just shooting ideas out there. ;)

anarcat avatar Oct 29 '17 01:10 anarcat

Yeah but it seems to me that it would be too complicated to do for a little gain. I really wish that sigal remains simple enough (KISS) and maintainable. The easiest to do would be to have some weighting with the file size, without trying to interact with the subprocess.

saimn avatar Nov 14 '17 18:11 saimn

okay so how about this - if we know the number of files, we can stat() them as well to figure out how big they are. so instead of just counting files, we count sizes. that would still stay simple yet at the same time provide a more realistic estimate...

anarcat avatar Nov 14 '17 18:11 anarcat

Yes, click has an example that is quite similar, that should work:

with click.progressbar(length=total_size,
                       label='Unzipping archive') as bar:
    for archive in zip_file:
        archive.extract()
        bar.update(archive.size)

saimn avatar Nov 14 '17 18:11 saimn

that's exactly where my idea came from, actually. :)

anarcat avatar Nov 15 '17 18:11 anarcat