# Update animate.py for gif creation using ffmpeg

As I tried to run Animated plots -- Sage Reference Manual v5.11: 2D Graphics and there the example

a = animate([sin(x + float(k)) for k in srange(0,2*pi,0.7)],
xmin=0, xmax=2*pi, figsize=[2,1])
dir = tmp_dir()
#a.ffmpeg(savefile=dir + 'new.mpg')       # optional -- ffmpeg
#a.ffmpeg(savefile=dir + 'new.avi')       # optional -- ffmpeg
a.ffmpeg(savefile=dir + 'new.gif')       # optional -- ffmpeg
#a.ffmpeg(savefile=dir + 'new.mpg', show_path=True) # optional -- ffmpeg


there appeared an error on the gif creation. Thus using the option verbose = true. There the error was explained to appear in
/Applications/Sage-5.11-OSX-64bit-10.6.app/Contents/Resources/sage/devel/sage-main/build/sage/plot/animate.py in line 570. There the line is

ffmpeg_options += ' -pix_fmt rgb24 -loop_output %s ' % iterations


where the option -loop_output should be changed to -loop as I did since ffmpeg states "This option is deprecated, use -loop". Then the creation of a gif file worked with my version of ffmpeg: 1.2.1, using the ffmpeg command but the file is still of minor quality compared to e.g. mp4.

So perhaps somebody of the staff team can change the animate.py file for future versions. I know that it should be done by a ticket but as a newbee I'm not familiar in making up a ticket. Thanks

edit retag close merge delete

Sort by » oldest newest most voted

Thanks for the report. This is now ticket 15081.

more