Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hello fellow IDLers, We have a nice animation running using XINTERANIMATE (IDl V4.0 on a SPARC) of a binary star and we want to show it to the public at a forthcoming open day. We only have a PC available at the open day so: Does anyone have a routine for writing MPEG files from IDL? advaTHANKSnce, Pierre Maxted Hannah Quaintrell -- _-_-_ _-_-_ | Dr Pierre Maxted (pflm@star.maps.susx.ac.uk) | | | Astronomy Centre, University of Sussex | | | Falmer, Brighton, BN1 9QH | -_-_- Procrastinate now!!! -_-_-
Pierre Maxted <pflm@star.maps.susx.ac.uk> writes: > We have a nice animation running using XINTERANIMATE (IDl V4.0 on a SPARC) > of a binary star and we want to show it to the public at a forthcoming open > day. We only have a PC available at the open day so: > Does anyone have a routine for writing MPEG files from IDL? I don't know of an mpeg writing routine but here is another suggestion. Write out the individual images as a sequence of images in a well known graphics format, e.g. tiff (using tiff_write). There are some applications around (I definitely know that moviemaker on SGI machines is able to do this but will only output SGI Movie and Quicktime formats) that allow you to create a movie from such a sequence of images. Hope something like that is an alternative for you, Christian ------------------------------------------------------------ -------- Christian Soeller mailto: csoelle@sghms.ac.uk St. Georges Hospital Medical School Dept. of Pharmacology Cranmer Terrace London SW17 0RE
Pierre Maxted wrote: > > Hello fellow IDLers, > We have a nice animation running using XINTERANIMATE (IDl V4.0 on a SPARC) > of a binary star and we want to show it to the public at a forthcoming open > day. We only have a PC available at the open day so: > Does anyone have a routine for writing MPEG files from IDL? > Enclosed below is a procedure "write_mpeg.pro" which does what you need. Load your sequential images into a single array (imageWidth x imageHeight x nFrames), then call this procedure as follows: write_mpeg, 'myMovie.mpg', imageArray NOTE: This procedure uses SPAWN to call an executable called "mpeg_encode", which actually creates the mpeg file. This is freely available at file://s2k-ftp.cs.berkeley.edu/pub/multimedia/mpeg/ For more information about recording or playing mpeg files, please see http://www.arc.umn.edu/GVL/Software/mpeg.html -- A. Scott Denning scott@abyss.Atmos.ColoState.edu Dept. of Atmospheric Science Phone (970)491-2134 Colorado State University Fax1 (970)491-8428 Fort Collins, CO 80523-1371 Fax2 (970)491-8449 ============================== C U T H E R E ====================== PRO WRITE_MPEG, mpegFileName, image_array movieSize = SIZE(image_array) xSize = movieSize(1) ySize = movieSize(2) nFrames = movieSize(3) nDigits = 1+FIX(ALOG10(nFrames)) formatString = STRCOMPRESS('(i'+STRING(nDigits)+'.'+STRING(nDigits)$ + ')', /REMOVE_ALL) ON_IOERROR, badWrite ; Make a temporary directory if necessary or clear it otherwise' TMPDIR = '/tmp/idl2mpeg.frames' SPAWN, 'if (-d ' + TMPDIR + ') echo "exists"', result dirExists = result(0) EQ 'exists' IF dirExists THEN command = 'rm ' + TMPDIR + '/*' $ ELSE command = 'mkdir ' + TMPDIR SPAWN, command ; Write each frame into TMPDIR as a 24-bit .ppm image file FOR frameNum = 0, nFrames-1 DO BEGIN fileName = TMPDIR + '/frame.' + STRING(frameNum,FORMAT=formatString)$ + '.ppm' image = pseudo_to_true(image_array(*,*,frameNum)) WRITE_PPM, fileName, image PRINT, 'Wrote temporary PPM file for frame ', frameNum+1 ENDFOR ; Build the mpeg parameter file paramFile = TMPDIR + '/idl2mpeg.params' OPENW, unit, paramFile, /GET_LUN PRINTF, unit, 'PATTERN IBBBBBBBBBBP' PRINTF, unit, 'OUTPUT ' + mpegFileName PRINTF, unit, 'GOP_SIZE 12' PRINTF, unit, 'SLICES_PER_FRAME 5' PRINTF, unit, 'BASE_FILE_FORMAT PPM' PRINTF, unit, 'INPUT_CONVERT *' PRINTF, unit, 'INPUT_DIR /tmp/idl2mpeg.frames' PRINTF, unit, 'INPUT' PRINTF, unit, '`ls *.ppm`' PRINTF, unit, 'END_INPUT' PRINTF, unit, 'PIXEL FULL' PRINTF, unit, 'RANGE 5' PRINTF, unit, 'PSEARCH_ALG LOGARITHMIC' PRINTF, unit, 'BSEARCH_ALG SIMPLE' PRINTF, unit, 'IQSCALE 6' PRINTF, unit, 'PQSCALE 6' PRINTF, unit, 'BQSCALE 6' PRINTF, unit, 'REFERENCE_FRAME ORIGINAL' PRINTF, unit, 'FORCE_ENCODE_LAST_FRAME' FREE_LUN, unit ; spawn a shell to process the mpeg_encode command SPAWN, 'mpeg_encode ' + paramFile RETURN badWrite: alert, 'Unable to write MPEG file!' END
Problem solved. Thanks to A. Scott Denning for his write_mpeg routine. -- _-_-_ _-_-_ | Dr Pierre Maxted (pflm@star.maps.susx.ac.uk) | | | Astronomy Centre, University of Sussex | | | Falmer, Brighton, BN1 9QH | -_-_- Procrastinate now!!! -_-_-