Files
UniversalTrain-ai/rl/mjrl/viewer/encoding.py
T
chenlin c32df70326
Checks / Layout, translation and Colab checks (push) Has been cancelled
Checks / Ruff (push) Has been cancelled
Checks / Framework tests (native backend, CPU) (push) Has been cancelled
Checks / Portable Rust controller (push) Has been cancelled
release: v0.1 generic robot training and application platform
2026-11-05 11:05:01 +08:00

14 lines
527 B
Python

"""One encoder configuration shared by batched training and native app replay."""
from pathlib import Path
def video_writer(path: Path, width: int, height: int, fps: float):
"""Return an unprimed RGB24-to-H.264 streaming writer."""
import imageio_ffmpeg
Path(path).parent.mkdir(parents=True, exist_ok=True)
return imageio_ffmpeg.write_frames(
str(path), (width, height), fps=fps, codec="libx264", pix_fmt_in="rgb24",
pix_fmt_out="yuv420p", macro_block_size=1, ffmpeg_log_level="error",
)