2

I generate png figures using python and then use mencoder to make a movie. I used the commend I searched online. It does generate a movie for me. But it's strange that it uses the first figure multiple times during the entire movie. That is not what I want. I'm not sure why. The code is below:

os.system("mencoder 'mf://_tmp*.png' -mf type=png:fps=10.0 -ovc vcodec=wmv2 -oac copy -o " + filename + ".mpg")
user5473110
  • 125
  • 1
  • 9

1 Answers1

0

I have not tested this, but I suspect that mencoder is sorting your frames by their filename, as strings. That is, the sort order will start like this:

_tmp1.png
_tmp10.png
_tmp100.png
_tmp101.png
_tmp102.png
...
_tmp109.png
_tmp11.png
_tmp110.png
_tmp111.png
_tmp112.png
...

(In the comments you say that your filenames actually look like _tmp100.png, _tmp200.png, etc., but the extra trailing zeros should make no difference.)

Obviously, this will cause every tenth frame in your final video to be misordered.

If this is the problem, zero-padding the frame numbers in your file names to a fixed length should fix it.

Community
  • 1
  • 1
Ilmari Karonen
  • 49,047
  • 9
  • 93
  • 153