@@ -2161,8 +2161,8 @@ def save_montage(self, filename, order=['lat', 'ven', 'med'],
2161
2161
return out
2162
2162
2163
2163
def save_movie (self , fname , time_dilation = 4. , tmin = None , tmax = None ,
2164
- framerate = 24 , interpolation = 'quadratic' , codec = 'mpeg4' ,
2165
- bitrate = '1M' ):
2164
+ framerate = 24 , interpolation = 'quadratic' , codec = None ,
2165
+ bitrate = None , ** kwargs ):
2166
2166
"""Save a movie (for data with a time axis)
2167
2167
2168
2168
.. Warning::
@@ -2188,11 +2188,6 @@ def save_movie(self, fname, time_dilation=4., tmin=None, tmax=None,
2188
2188
Interpolation method (``scipy.interpolate.interp1d`` parameter,
2189
2189
one of 'linear' | 'nearest' | 'zero' | 'slinear' | 'quadratic' |
2190
2190
'cubic', default 'quadratic').
2191
- codec : str
2192
- Codec to use with ffmpeg (default 'mpeg4').
2193
- bitrate : str | float
2194
- Bitrate to use to encode movie. Can be specified as number (e.g.
2195
- 64000) or string (e.g. '64k'). Default value is 1M
2196
2191
2197
2192
Notes
2198
2193
-----
@@ -2211,6 +2206,15 @@ def save_movie(self, fname, time_dilation=4., tmin=None, tmax=None,
2211
2206
"run\n \n $ pip install -U "
2212
2207
"pysurfer[save_movie]\n " )
2213
2208
2209
+ # find imageio FFMPEG parameters
2210
+ if 'fps' not in kwargs :
2211
+ kwargs ['fps' ] = framerate
2212
+ if codec is not None :
2213
+ kwargs ['codec' ] = codec
2214
+ if bitrate is not None :
2215
+ kwargs ['bitrate' ] = bitrate
2216
+
2217
+ # find tmin
2214
2218
if tmin is None :
2215
2219
tmin = self ._times [0 ]
2216
2220
elif tmin < self ._times [0 ]:
@@ -2238,8 +2242,7 @@ def save_movie(self, fname, time_dilation=4., tmin=None, tmax=None,
2238
2242
% (times , time_idx ))
2239
2243
images = (self .screenshot () for _ in
2240
2244
self ._iter_time (time_idx , interpolation ))
2241
- imageio .mimwrite (fname , images , fps = framerate , codec = codec ,
2242
- bitrate = bitrate )
2245
+ imageio .mimwrite (fname , images , ** kwargs )
2243
2246
2244
2247
def animate (self , views , n_steps = 180. , fname = None , use_cache = False ,
2245
2248
row = - 1 , col = - 1 ):
0 commit comments