INNER CODE UNIT · Python
extract_frames
unitedrhino/things · scripts/generate-energy-demo-svg.py:51
def extract_frames(demo: Demo, target: Path) -> list[Path]:
"""extract_frames 按固定帧率和宽度提取 JPEG,避免 README 资源体积失控。"""
command = [
"ffmpeg",
"-v",
"error",
"-threads",
"2",
"-i",
str(demo.source),
"-t",
str(demo.duration),
"-vf",
f"fps={FRAME_RATE},scale={FRAME_WIDTH}:-2:flags=lanczos",
"-q:v",
str(JPEG_QUALITY),
str(target / "frame-%04d.jpg"),