neu_draw.video¶
Finding ffmpeg, encoding frames with it, and the result of an orbit. Standard library only, so it works and is tested without a renderer.
ffmpeg is never declared as a dependency: put one on PATH or name it with
$NEU_DRAW_FFMPEG. Without one, the frames are kept and a plain ffmpeg command is
printed.
Attributes¶
Classes¶
What a render produced: the frames, and the video if one was encoded. |
Functions¶
|
The argv for an encode, run without a shell, so no path needs quoting. |
|
The ffmpeg to encode with, or |
|
Run ffmpeg over the frames. Raises with ffmpeg's own last lines if it fails. |
Module Contents¶
- class neu_draw.video.Orbit¶
What a render produced: the frames, and the video if one was encoded.
- command(ffmpeg: str = 'ffmpeg') str¶
The encode as one line to paste into a shell.
- directory: str¶
- fps: float¶
- frames: int¶
- output: str | None = None¶
- rendered: int¶
- size: tuple[int, int]¶
- video: str | None = None¶
- neu_draw.video.encode_args(ffmpeg: str, directory: str, fps: float, output: str) list[str]¶
The argv for an encode, run without a shell, so no path needs quoting.
- neu_draw.video.find_ffmpeg(explicit: str | None = None) str | None¶
The ffmpeg to encode with, or
None. First match wins:explicit: a path, or a name to look up onPATH;$NEU_DRAW_FFMPEG, the same from the environment;ffmpegonPATH(e.g. a site module loaded before starting Jupyter);imageio-ffmpeg’s bundled binary, if the user has installed that package.
An explicit choice (1 or 2) that is not executable raises rather than falling through, so the binary used is never a different one from the one named.
- neu_draw.video.run_encode(directory: str, fps: float, output: str, ffmpeg: str) str¶
Run ffmpeg over the frames. Raises with ffmpeg’s own last lines if it fails.
- neu_draw.video.ENCODE_ARGS = ('-c:v', 'libx264', '-pix_fmt', 'yuv420p', '-crf', '18')¶
- neu_draw.video.ENCODE_MODES = ('auto', True, False)¶
- neu_draw.video.FFMPEG_ENV = 'NEU_DRAW_FFMPEG'¶
- neu_draw.video.FRAME_PATTERN = 'frame_%05d.png'¶