Merge pull request #9 from Geonhee-LEE/master
Bug fixed for saving .mp4 format
This commit is contained in:
commit
969fee7e73
|
@ -4,6 +4,7 @@ from logging import getLogger
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from matplotlib.animation import FuncAnimation
|
from matplotlib.animation import FuncAnimation
|
||||||
|
import matplotlib.animation as animation
|
||||||
|
|
||||||
logger = getLogger(__name__)
|
logger = getLogger(__name__)
|
||||||
|
|
||||||
|
@ -66,8 +67,12 @@ class Animator():
|
||||||
self._setup()
|
self._setup()
|
||||||
_update_img = lambda i: self._update_img(i, history_x, history_g_x)
|
_update_img = lambda i: self._update_img(i, history_x, history_g_x)
|
||||||
|
|
||||||
|
# Set up formatting for the movie files
|
||||||
|
Writer = animation.writers['ffmpeg']
|
||||||
|
writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)
|
||||||
|
|
||||||
# call funcanimation
|
# call funcanimation
|
||||||
animation = FuncAnimation(
|
ani = FuncAnimation(
|
||||||
self.anim_fig,
|
self.anim_fig,
|
||||||
_update_img, interval=self.interval, frames=len(history_x)-1)
|
_update_img, interval=self.interval, frames=len(history_x)-1)
|
||||||
|
|
||||||
|
@ -76,4 +81,4 @@ class Animator():
|
||||||
"animation-" + self.env_name + ".mp4")
|
"animation-" + self.env_name + ".mp4")
|
||||||
logger.info("Saved Animation to {} ...".format(path))
|
logger.info("Saved Animation to {} ...".format(path))
|
||||||
|
|
||||||
animation.save(path, writer="ffmpeg")
|
ani.save(path, writer=writer)
|
||||||
|
|
Loading…
Reference in New Issue