Re-encoding Movie Files

Here is how you can re-encode a movie file using visit_utils on a linux/unix or OSX system with ffmpeg installed:

  • Launch VisIt's cli
visit -nowin -cli 
  • Use the following example:
from visit_utils import encoding
# the input can be almost any video file, not just an mpg
encoding.extract("input.mpg","frames%04d.png")
# this will extract frames0000.png frames0001.png ... from your input file
for ext in ["mpg","wmv","mov"]:
   encoding.encode("frames%04d.png","output." + ext)
# this will encode your movie to three types of output files:
# 1) mpeg1 (output.mpg)
# 2) msmpeg4 in a wmv container (output.wmv)
# 3) mpeg4 in a mov container (output.mov)

Notes:

  • In our experince, mpg and wmv work on most platforms (windows, osx + linux/unix).
  • mov may provide slighlty better quality.
  • If you want to dupcalite frames to slow the playback of your content, use the fdup option:
...
for ext in ["mpg","wmv","mov"]:
  encoding.encode("frames%04d.png","output." + ext,fdup=2)
# example this will re-use each frame two times