Skip to content

Server-side Video Making via `logger.make_video`

Latest
Compare
Choose a tag to compare
@geyang geyang released this 11 Aug 22:00
· 94 commits to main since this release

ml-logger now supports making videos from a collection of images. See usage bellow for v0.8.83.

def test_make_video():
    import scipy.misc

    face = scipy.misc.face()
    h, w, _ = face.shape
    for i in range(10):
        logger.save_image(face[i:h - 100 + i, i:w - 100 + i], f"face_{i:04d}.png")

    file_list = logger.glob("face_*.png")
    # This one makes the video according to ascending order
    logger.make_video("face_*", key="videos/face_move_glob.mp4")
    logger.make_video("face_*", order='descending', key="videos/face_move_glob_descending.mp4")
    # This one makes the video according to the random order given by glob
    logger.make_video(file_list, key="videos/face_move_list.mp4")

    # this should not reaise an error
    path = logger.make_video("no_exist_*.png", key="videos/not_exist.mp4")
    assert path is None