Skip to content

Commit 102fac3

Browse files
committed
Fix video codecs for some formats with ffmpeg
ffmpeg seems to pick the best encoder based on the file extension for these, and using the default of `h264` just fails.
1 parent e8654e1 commit 102fac3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/animation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,9 @@ class FFMpegBase:
506506
@property
507507
def output_args(self):
508508
args = []
509-
if Path(self.outfile).suffix == '.gif':
510-
self.codec = 'gif'
509+
suffix = Path(self.outfile).suffix
510+
if suffix in {'.apng', '.avif', '.gif', '.webm', '.webp'}:
511+
self.codec = suffix[1:]
511512
else:
512513
args.extend(['-vcodec', self.codec])
513514
extra_args = (self.extra_args if self.extra_args is not None

0 commit comments

Comments
 (0)