Animation MPEG Conversion Tips
Goal: Guide to convert a CDAT/VCDAT Sun raster animation file into multiple individual *.mpeg files.
Note this script uses ImageMagick to convert the Sun raster file to *.mpeg. Therefore you must have ImageMagick installed on your machine.
C Shell script to convert a *.ras file to individual *.mpeg files (ras2mpeg):
#!/bin/cshTo execute the script type the following:
echo "...dividing *.ras file into individual frame files"
convert $1.ras $1.temp.%04d.ras
echo "...swapping red and blue channels"
foreach d ($1.temp.*.ras)
convert $d \( +clone -channel red -fx b +channel \) +swap \
-channel blue -fx v.r +channel rb_swapped.$d
end
echo "...red and blue channels have been swapped"
/bin/rm $1.temp.*.ras
echo "...original individual frame files have been deleted"
echo "...creating *.mpeg file"
convert rb_swapped.$1.temp.*.ras $1.mpeg
echo "...*.mpeg file has been created"
echo "...deleting rb_swapped* files"
/bin/rm rb_swapped.$1.temp.*.ras
echo "...rb_swapped* files have been deleted"
echo "***END SCRIPT***"
% chmod 777 ras2mpeg
% ./ras2mpeg filename
where ras2mpeg is the name of the script, and filename is the name
of the VCDAT-generated Sun raster file (Do not include the ".ras".)
If you receive the following error:
% ./ras2mpeg test
...dividing *.ras file into individual frame files
...swapping red and blue channels
...red and blue channels have been swapped
...original individual frame files have been deleted
...creating *.mpeg file
sh: mpeg2encode: command not found
convert: Delegate failed `"mpeg2encode" "%i" "%o"'.
...*.mpeg file has been created
...deleting rb_swapped* files
...rb_swapped* files have been deleted
***END SCRIPT***
Then you need to install the external MPEG-2 Encoder / Decoder software. The MPEG software can be found at: ftp://ftp.mpeg.org/pub/mpeg/mssg/, or the web site: http://www.mpeg.org/MSSG/.
Retrieve the mpeg2vidcodec_v12.tar.gz compressed tar file and place the mpeg2encode and mpeg2decode executables in the appropriate /bin directory (e.g., /usr/local/bin).