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
Burnin
directly.
- Type:
- property codecΒΆ
The codec to use.
Attention
Please check the supported codecs. The passed
str
will 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
data
attribute 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