RenderersΒΆ
Renderer module combining Operators, Generators and Processors for final image or video file.
- class lablib.renderers.BasicRenderer(source_sequence, output_dir, **kwargs)[source]ΒΆ
Basic renderer for image sequences.
Note
Also supports single image rendering but needs to support more formats. PSDs would be really nice to have.
Example
# render sequence into a ProRes with a basic reformat to 1080p rend = BasicRenderer( processor=OIIORepositionProcessor( dst_width=1920, dst_height=1080, fit="letterbox", ), source_sequence=SequenceInfo.scan("resources/public/plateMain/v002")[0], output_dir="test_results/reformat_1080p/letterbox", codec="ProRes422-HQ", fps=25, keep_only_container=False, ) rend.render(debug=True)
- source_sequenceΒΆ
The source sequence to render.
- Type:
- output_dirΒΆ
The output directory.
- Type:
Union[Path, str]
- nameΒΆ
The name of the output file.
- Type:
str
- threadsΒΆ
The number of threads to use for rendering.
- Type:
int
- keep_only_containerΒΆ
Keep only the container file.
- Type:
bool
- property audioΒΆ
The path to an audio file to be used.
The passed string will be resolved to an absolute path object.
- Type:
str
- property burninsΒΆ
The burnins to use.
Attention
Please check the Burnin class for formatting. Currently you can only pass in a dict formatted accordingly.
Todo
Should also accept passing a
Burnindirectly.
- Type:
- property codecΒΆ
The codec to use.
Attention
Please check the supported codecs. The passed
strwill be looked up against them.- Type:
- property fpsΒΆ
The frames per second to use.
Todo
should be a float. But currently only 24 and 25 are tested.
testing with 23.976 and 29.97 would be nice.
- Type:
int
- get_ffmpeg_cmd()[source]ΒΆ
Get arguments for rendering with ffmpeg.
- Returns:
The ffmpeg arguments.
- Return type:
List[str]
- get_oiiotool_cmd(debug=False)[source]ΒΆ
Get arguments for rendering with OIIO.
- Parameters:
debug (Optional[bool]) β Whether to increase log verbosity.
- Returns:
The OIIO arguments.
- Return type:
List[str]
- property processorΒΆ
The processor to use for rendering.
- Type:
Any
- render(debug=False)[source]ΒΆ
Render the sequence with the given options.
Important
This always tries to render into a local temporary EXR sequence first and then converts it to the desired codec. These will then be attempted to be copied to the output directory. In any case, the temporary directory will be cleaned up afterwards.
Hint
If youβre only interested in the video file you can set
BasicRenderer(*args, keep_only_container=True).- Parameters:
debug (Optional[bool]) β Whether to increase log verbosity.
- class lablib.renderers.Burnin(data=<factory>, size=64, padding=30, color=(1, 1, 1), font=None, outline=None)[source]ΒΆ
Utility class for handling burnins with OIIO.
Example
dataattribute structure{ "text": "YOUR_TEXT_HERE", "position": [ "top_left" "top_center" "top_right" "bottom_left" "bottom_center" "bottom_right" ], },
- dataΒΆ
The text to be drawn and its positioning.
- Type:
Dict[str, str]
- sizeΒΆ
The size of the text.
- Type:
int
- paddingΒΆ
The padding around the text.
- Type:
int
- colorΒΆ
The color of the text.
- Type:
Set[float]
- fontΒΆ
The font to use.
- Type:
Optional[str]
- outlineΒΆ
The outline size.
- Type:
Optional[int]
- class lablib.renderers.Codec(name=<factory>)[source]ΒΆ
Utility class for abstracting ffmpeg codec arguments.
Important
Currently this only supports 2 flavors of ProRes and 1 of DNxHR but could deserve more. Supported codecs are:
ProRes422-HQ,ProRes4444-XQ,DNxHR-SQ- nameΒΆ
The name of the codec.
- Type:
str
- class lablib.renderers.RendererBase[source]ΒΆ
Base class for all renderers.
This should not be instanciated directly.
- class lablib.renderers.SlateRenderer(slate_generator, source_sequence, destination=None)[source]ΒΆ
Class for rendering slates.
Example
# render slate image to 1080p slate_generator = SlateHtmlGenerator( # data used to fill up the slate template { "project": {"name": "test_project"}, "intent": {"value": "test_intent"}, "task": {"short": "test_task"}, "asset": "test_asset", "comment": "some random comment", "scope": "test_scope", "@version": "123", }, "/templates/slates/slate_generic/slate_generic.html", ) rend = SlateRenderer( slate_generator, SequenceInfo.scan("resources/public/plateMain/v002")[0], ) rend.render(debug=True)
- property destinationΒΆ
Returns: str: The renderer destination.
- render(debug=False)[source]ΒΆ
Render the slate sequence.
- Parameters:
debug (Optional[bool]) β Whether to increase log verbosity.
- property slate_generatorΒΆ
Returns: SlateHtmlGenerator: The generator associated to the renderer.
- property source_sequenceΒΆ
Return the source sequence.
- Returns:
SequenceInfo. The source sequence.