comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » XINTERANIMATE -> MPEG?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
XINTERANIMATE -> MPEG? [message #6801] Thu, 29 August 1996 00:00 Go to next message
Pierre Maxted is currently offline  Pierre Maxted
Messages: 3
Registered: November 1995
Junior Member
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!!! -_-_-
Re: XINTERANIMATE -> MPEG? [message #6921 is a reply to message #6801] Mon, 02 September 1996 00:00 Go to previous message
Pierre Maxted is currently offline  Pierre Maxted
Messages: 3
Registered: November 1995
Junior Member
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!!! -_-_-
Re: XINTERANIMATE -> MPEG? [message #6928 is a reply to message #6801] Fri, 30 August 1996 00:00 Go to previous message
A. Scott Denning is currently offline  A. Scott Denning
Messages: 5
Registered: July 1996
Junior Member
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
Re: XINTERANIMATE -> MPEG? [message #6943 is a reply to message #6801] Thu, 29 August 1996 00:00 Go to previous message
Christian Soeller is currently offline  Christian Soeller
Messages: 46
Registered: August 1996
Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Mouse and window problem
Next Topic: (x)emacs support for IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:44:12 PDT 2025

Total time taken to generate the page: 0.00693 seconds