How to improve the speed of image.save_png ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By hkxu3

Hi everyone, I created a project with godot.
I have a character model, every frame I will change its blendshape value to make expressions or talk.
So every frame I will use var tex = get_viewport().get_texture() to get the ViewportTexture
Then in order to increase the speed, I use multiple threads to process tex.save_png()

Finally I use ffmpeg to combine pictures and audio.

Now to create a 1 minute video, it will take me about 2 minutes.

I found that get_viewport().get_texture()took the most time. Is there a way to process get_viewport().get_texture()async?

THX

https://docs.godotengine.org/en/stable/tutorials/threads/using_multiple_threads.html

What I tried in my game is Semaphores
It will just put the processing in a thread other than the main thread.
It will not speed it up, at least in my observation.

nightrobin | 2020-09-08 23:20