Skip to content

FFMpeg multi-threaded recording #2820

@ghost

Description

When using ffmpeg to record an .mp4 movie of a matplotlib animation with something like

anm.save('movie.mp4', writer='ffmpeg', extra_args=['-threads', 'n'])

where anm and n are the animation object and the number of threads, respectively, it seems that the global interpreter lock prevents from correctly distributing the task of encoding among available cpu cores.

Of course, one can avoid this by first breaking the animation into n chunks and encoding each using ffmpeg with, for example, Python's multiprocessing library, and then stitching the resulting 'n' movies into a single one.

Would the above be the best solution, or should perhaps matplotlib try to handle this internally?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions