Using FFmpeg and IPython

后端 未结 1 728
抹茶落季
抹茶落季 2020-11-29 10:14

I am relatively new to Python (I used MATLAB a lot more). I essentially want to be able to make and save animations. So I went and checked how it\'s done and found this : ht

相关标签:
1条回答
  • 2020-11-29 11:18

    I came across the exact same error as I started working with animations using the exact same example to start with. First of all,

    I am using Windows 7, Python 2.7.6, matplotlib 1.3.1

    Short answer: Try to set up the FFMpegWriter yourself by

    mywriter = animation.FFMpegWriter()
    anim.save('mymovie.mp4',writer=mywriter)
    

    Long answer: I am quite sure that there is a bug in matplotblib.animation.save There is the following line

    if is_string_like(writer):
    

    to catch the case that the user defined writer is actually not a writer function but just its name. It then instanciates an instance of that writer if it's available

    if writer in writers.avail:
         writer = writers[writer](fps, codec, bitrate,
                                  extra_args=extra_args,
                                  metadata=metadata
    

    However, and here is the bug, if the user defined writer is not in writers.avail it just uses

    writer = writers.list()[0]
    

    which itself returns a string with the name of the writer to be used. However, this string is nowhere used to actually instanciate a writer object!

    0 讨论(0)
提交回复
热议问题