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

Home » Public Forums » archive » MPEG creation with IDL
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
MPEG creation with IDL [message #5527] Tue, 16 January 1996 00:00 Go to next message
Bringfried Stecklum is currently offline  Bringfried Stecklum
Messages: 75
Registered: January 1996
Member
Probably, this is almost a FAQ but, nevertheless, here is the question. Is
anybody aware of an procedure coded in IDL to create MPEG movies from a
datacube?
Any suggestions are highly appreciated.

Best regards,

+---------------------------------------------------------+
| Bringfried Stecklum |
| MPG research unit "Dust in Star Forming Regions" |
| Schillergaesschen 3, FRG-07745 Jena, Germany |
| Internet: stecklum@astro.uni-jena.de |
| FAX: 049 3641 55594 |
| Phone: 049 3641 55593 or 049 3641 630307 |
+---------------------------------------------------------+
Re: MPEG creation with IDL [message #5615 is a reply to message #5527] Sat, 20 January 1996 00:00 Go to previous message
dean is currently offline  dean
Messages: 55
Registered: March 1993
Member
The mpeg_encode I use requires PPM (24-bit files) as input. IDL 4.0+
has WRITE_PGM which setup correctly will create a 24-bit PPM file. The
MPEG_ENCODE - free from s2k-ftp.cs.berkeley.edu - will except these
PPM with no problem. This removes the GIF to PPM step I did once before.

Kelly Dean
CSU/CIRA
Re: MPEG creation with IDL [message #5641 is a reply to message #5527] Thu, 18 January 1996 00:00 Go to previous message
scott is currently offline  scott
Messages: 17
Registered: January 1994
Junior Member
The following idl procedure will produce an mpeg file from a series of
images stored in a 3D array (width x height x # of frames). It requires
the "mpeg_encode" executable to be inthe unix search path. This can be
obtained from ftp://s2k-ftp.cs.berkeley.edu/pub/multimedia/mpeg/encode.

There are lots of options that can be handled differently, to make
tradeoffs between image quality, speed, and disk space. See the
documentation for mpeg_encode for more details.

If your animation is stored in the array "image_array" and you want to
write it to a file called "movie.mpg," you would do so by typing

WRITE_MPEG, 'movie.mpg', image_array

Best of luck!

--
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)
; Load current color table into byte arrays
TVLCT, red, green, blue, /GET
red = BYTE(red)
green = BYTE(green)
blue = BYTE(blue)

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 an 8-bit .gif image file
FOR frameNum = 0, nFrames-1 DO BEGIN
fileName = TMPDIR + '/frame.' + STRING(frameNum,FORMAT=formatString)$
+ '.gif'
WRITE_GIF, fileName, image_array(*,*,frameNum), red, green, blue
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 giftoppm *'
PRINTF, unit, 'INPUT_DIR /tmp/idl2mpeg.frames'
PRINTF, unit, 'INPUT'
PRINTF, unit, '`ls *.gif`'
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 8'
PRINTF, unit, 'PQSCALE 8'
PRINTF, unit, 'BQSCALE 8'
PRINTF, unit, 'REFERENCE_FRAME DECODED'
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: MPEG creation with IDL [message #5642 is a reply to message #5527] Thu, 18 January 1996 00:00 Go to previous message
jacobsen is currently offline  jacobsen
Messages: 28
Registered: July 1992
Junior Member
If you write a bunch of GIF files, there are unix packages
for turning them into an MPEG file. Search yahoo under
make_mpeg

--
Chris Jacobsen, Department of Physics, SUNY at Stony Brook
E-mail: jacobsen@xray1.physics.sunysb.edu
Home page: http://xray1.physics.sunysb.edu/~jacobsen/
Re: MPEG creation with IDL [message #5649 is a reply to message #5527] Wed, 17 January 1996 00:00 Go to previous message
Eric Deutsch is currently offline  Eric Deutsch
Messages: 11
Registered: May 1995
Junior Member
Bringfried Stecklum wrote:
>
> Probably, this is almost a FAQ but, nevertheless, here is the question. Is
> anybody aware of an procedure coded in IDL to create MPEG movies from a
> datacube?
> Any suggestions are highly appreciated.

As far as I know there is nothing in IDL to create MPEG movies.
To make MPEG movies, I use IDL to create a series of .GIF images
and then use a unix utility called mpeg_encode (available somewhere
via anonymous ftp; ask archie) to create the movie from the GIF series.

For example, I have a script set up which gets an image from an IR
sky scanner, stretches the image appropriately, overlays coordinate grids,
etc. and writes a GIF image. Then, the script calls mpeg_encode to
make a movie. If anyone is interested, you can see archived Apache Point
Observatory all-sky image movies at the address:

http://www.astro.washington.edu/deutsch/apoinfo/cloudscan/mp egarchive.html
and
http://www.astro.washington.edu/deutsch/apoinfo/cloudscan/la testimage.html

This page also points to various other pages that allows one to view each
all-sky image as it comes from the camera, etc. The camera only runs
at night and when there is no precipatation.

Eric

--
------------------------------------------------------------ ----------------
Eric Deutsch email: deutsch@astro.washington.edu
Department of Astronomy Voice: (206) 616-2788
University of Washington FAX: (206) 685-0403
Box 351580 WWW: http://www.astro.washington.edu/deutsch
Seattle, WA 98195-1580 Physics/Astronomy Bldg., Room B356F
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: writing to 2 "windows" in idl?
Next Topic: Large Arrays in IDL

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

Current Time: Wed Oct 08 15:51:45 PDT 2025

Total time taken to generate the page: 0.00664 seconds