Pitivi's Proxy Preparation Procedure
07 Aug 2018Internally, most of the code for handling proxies resides in proxy.py
which exposes the proxy_manager
class to create and monitor proxy assets.
To create a proxy, we call add_job
function in proxy_manager
which takes the GES.Asset
that we wish to proxy as its argument, performs some checks and passes it on to another function.
This function is now responsible for getting the suitable EncodingProfile
and starting off a GstTranscoder
on the asset with this profile as its target format.
The transcoder runs asynchronously, reporting progress periodically which is used to update the UI in the Media Library.
When the transcoder finishes, we GES.request_async
the resulting proxy file and set it as the proxy on the original asset.
The modifications required for the generation of scaled proxies are fairly straightforward, just set_restriction
on the EncodingProfile
telling it the height and width that we wish to scale the asset to and let GstTranscoder
work its wonders.
The complications lie mostly in adapting the current framework that is used for initiating proxy creation, managing proxies during their lifecycle and handling of edge cases like poorly supported the formats or the changing of the target resolution for scaled proxies mid-way through.