How to get actual rendering progress and estimation from render_stats python handler? There is render_stats bpy handler

It seem like it is invoked every time rendering engine prints to console smth like

Fra:0 Mem:410.70M (0.00M, Peak 450.46M) | Remaining:01:16:22.96 | Mem:307.83M, Peak:307.83M | _mainScene, interior | Path Tracing Tile 18/8160


I am wondering if  there is a way to get numbers like estimate(01:16:22.96) and current tile(18) from render_stats handler in python script?

Now the only way I see to get this is parsing blender output which is not very cool

There is something alike it in UI, but there is no tooltip with python snippet for it:


This question may seem alike Is it possible to get render time per tile?, and it's stands there that you can't. But in there it's about render time for specific tile, and I am asking about render time estimation for particular frame, may be you can get overall estimation?
I know it's not the best, but the best I've been able to come up with is code that processes the console output:


Output gives you the render time of the last frame
Output tells you the frame number that was just rendered
You know how many frames are in the complete render, which you can pass to your program
You know the start time of the render


From the above, you can calculate the average render time per frame, which I've found after just a few minutes becomes a pretty stable value.  If the number of rendered objects per frame changes dramatically over time, then of course the average value will change, but given the average render time per frame, you can come up with:


Number of frames which were rendered - grab that from the console
Amount of time elapsed (Current time - Start time)
Current running average render time per frame
Frames left * average time/frame == Render time left


If you have multiple scenes within an animation, you can then also do per-scene calculations, along with the overall animation calculation.

Again, it's not the optimal solution, but it's pretty easy to put together, and it does an effective job of informing you how much time do you have to go before your animation is done.

I hope this helps.