title: making a GIF from imges in any order with python
body: <p>I'm trying to make a gif out of a sequence of png format pics with python language in ubuntu 12.04. I have a file which my pictures are in it. they are named as, lip_shapes1.png to lip_shapes11.png. also I have a list with names of images in it which i want to make that gif in this sequence. the list looks like this:</p>
  
  <pre><code>list = [lip_shapes1.png, lip_shapes4.png , lip_shapes11.png, lip_shapes3.png]
  </code></pre>
  
  <p>but my problem is that i found this code :</p>
  
  <pre><code>import os
  os.system('convert   -loop 0   lip_shapes*.gnp   anime.gif')
  </code></pre>
  
  <p>but it only makes gif in the order of the gnp's names, but I want it to be in any order I want. is it possible?</p>
  
  <p>if anybody can help me i really appreciate it.</p>
  
  <p>thanks in advance</p>
  
  <p>PS: i also want to make a movie out of it. i tried this code(shapes is my list of images names):</p>
  
  <pre><code>    s = Popen(['ffmpeg', '-f', 'image2', '-r', '24', '-i'] + shapes + ['-vcodec', 'mpeg4', '-y', 'movie.mp4'])
  s.communicate()
  </code></pre>
  
  <p>but it gives me this in terminal and doesnt work:</p>
  
  <blockquote>
    <p>The ffmpeg program is only provided for script compatibility and will be removed
    in a future release. It has been deprecated in the Libav project to allow for
    incompatible command line syntax improvements in its replacement called avconv
    (see Changelog for details). Please use avconv instead.</p>
    
    <p>Input #0, image2, from 'shz8.jpeg':
      Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
        Stream #0.0: Video: mjpeg, yuvj420p, 266x212 [PAR 1:1 DAR 133:106], 24 tbr, 24 tbn, 24 tbc</p>
  </blockquote>
  
  <p>shz8.jpeg is the first name on the list.</p>
  
  <p>thanks</p>