diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 3f3e62490d93..6ef1a04d7f35 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -570,7 +570,9 @@ class FFMpegBase: @property def output_args(self): - args = ['-vcodec', self.codec] + args = [] + if not Path(self.outfile).suffix == '.gif': + args.extend(['-vcodec', self.codec]) extra_args = (self.extra_args if self.extra_args is not None else mpl.rcParams[self._args_key]) # For h264, the default format is yuv444p, which is not compatible