lvsfunc.render
Clip rendering helpers.
|
Render a clip by requesting frames asynchronously using clip.get_frame_async. |
|
Generate a list of scene changes (keyframes). |
- class lvsfunc.render.RenderContext(clip, queued)
Bases:
object
Contains info on the current render operation.
- clip: vstools.vs.VideoNode
- condition: Condition
- frames: dict[int, vstools.vs.VideoFrame]
- frames_rendered: int
- queued: int
- timecodes: list[float]
- lvsfunc.render.clip_async_render(clip, outfile=None, timecodes=None, progress='Rendering clip...', callback=None)
Render a clip by requesting frames asynchronously using clip.get_frame_async.
You must provide a callback with frame number and frame object.
This is mostly a re-implementation of VideoNode.output, but a little bit slower since it’s pure python. You only really need this when you want to render a clip while operating on each frame in order or you want timecodes without using vspipe.
- Parameters
clip (
VideoNode
) – Clip to render.outfile (
Optional
[BinaryIO
]) – Y4MPEG render output BinaryIO handle. If None, no Y4M output is performed. Usesys.stdout.buffer()
for stdout. (Default: None)timecodes (
Optional
[TextIO
]) – Timecode v2 file TextIO handle. If None, timecodes will not be written.progress (
Optional
[str
]) – String to use for render progress display. If empty orNone
, no progress display.callback (
Union
[Callable
[[int
,VideoFrame
],None
],list
[Callable
[[int
,VideoFrame
],None
]],None
]) – Single or list of callbacks to be performed. The callbacks are called. when each sequential frame is output, not when each frame is done. Must have signatureCallable[[int, vs.VideoNode], None]
Seelvsfunc.comparison.diff()
for a use case (Default: None).
- Return type
list
[float
]- Returns
List of timecodes from rendered clip.
- Raises
ValueError – Variable format clip is passed.
InvalidColorFamilyError – Non-YUV or GRAY clip is passed.
ValueError – “What have you done?”
- lvsfunc.render.find_scene_changes(clip, mode=0)
Generate a list of scene changes (keyframes).
Dependencies:
vapoursynth-scxvid (Optional: scxvid mode)
- Parameters
clip (
VideoNode
) – Clip to search for scene changes. Will be rendered in its entirety.mode (
SceneChangeMode
) –Scene change detection mode:.
WWXD: Use wwxd
SCXVID: Use scxvid
WWXD_SCXVID_UNION: Union of wwxd and sxcvid (must be detected by at least one)
WWXD_SCXVID_INTERSECTION: Intersection of wwxd and scxvid (must be detected by both)
- Return type
list
[int
]- Returns
List of scene changes.
- Raises
ValueError – Invalid
mode
gets passed.
- lvsfunc.render.finish_frame(outfile, timecodes, ctx)
Output a frame.
- Parameters
outfile (
Optional
[BinaryIO
]) – Output IO handle for Y4MPEG.timecodes (
Optional
[TextIO
]) – Output IO handle for timecodesv2.ctx (
RenderContext
) – Rendering context.
- Return type
None