Re: How 2 show animations. [message #79458] |
Mon, 05 March 2012 00:24 |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On Mar 3, 9:59 am, DavePoreh <d.po...@gmail.com> wrote:
> On Mar 2, 9:41 pm, Brian Wolven <brian.wol...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>> I use the approach described in the link below, combined with a shell script to manipulate the desired set of files.
>
>> How to make scientific movies with ffmpeg -http://web.mit.edu/robyn/www/ffmpeghowto.html
>
>> Script (bash):
>
>> #!/bin/bash
>
>> root=~/your/path/goes/here/
>> mission=$1
>> year=$2
>
>> # Set working directory to the specified root [data] directory.
>> cd $root
>> # Remove any existing temporary image symbolic links.
>> # Generate temporary image symbolic links to requested static image files,
>> # then generate animation from the sequentially numbered temporary images.
>
>> rm /tmp/img???.png
>
>> x=1; for i in ./$mission/$year/???/${mission}_data_${year}*.png; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".png; x=$(($x+1)); done
>
>> ffmpeg -f image2 -r 6 -i /tmp/img%03d.png -b 3200k -y ./${mission}_${year}_data.mp4
>
>> # Set working directory back to original location.
>> cd -
>
> Thanks guys all. i did it with imagemagick and looks fine now. just a
> tiny question: is there any way to control the speed of coming images.
> to slow down or make it faster?
> Cheers,
> Dave
Thanks guys, i have solved that:
dave@dave:~/Desktop/animation$ convert *.png -delay 100 yy.gif
and it is much better now.
Thank you very much,
Cheers,
Dave
|
|
|
Re: How 2 show animations. [message #79467 is a reply to message #79458] |
Sat, 03 March 2012 00:59  |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On Mar 2, 9:41 pm, Brian Wolven <brian.wol...@gmail.com> wrote:
> I use the approach described in the link below, combined with a shell script to manipulate the desired set of files.
>
> How to make scientific movies with ffmpeg -http://web.mit.edu/robyn/www/ffmpeghowto.html
>
> Script (bash):
>
> #!/bin/bash
>
> root=~/your/path/goes/here/
> mission=$1
> year=$2
>
> # Set working directory to the specified root [data] directory.
> cd $root
> # Remove any existing temporary image symbolic links.
> # Generate temporary image symbolic links to requested static image files,
> # then generate animation from the sequentially numbered temporary images.
>
> rm /tmp/img???.png
>
> x=1; for i in ./$mission/$year/???/${mission}_data_${year}*.png; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".png; x=$(($x+1)); done
>
> ffmpeg -f image2 -r 6 -i /tmp/img%03d.png -b 3200k -y ./${mission}_${year}_data.mp4
>
> # Set working directory back to original location.
> cd -
Thanks guys all. i did it with imagemagick and looks fine now. just a
tiny question: is there any way to control the speed of coming images.
to slow down or make it faster?
Cheers,
Dave
|
|
|
Re: How 2 show animations. [message #79473 is a reply to message #79467] |
Fri, 02 March 2012 12:41  |
Brian Wolven
Messages: 94 Registered: May 2011
|
Member |
|
|
I use the approach described in the link below, combined with a shell script to manipulate the desired set of files.
How to make scientific movies with ffmpeg - http://web.mit.edu/robyn/www/ffmpeghowto.html
Script (bash):
#!/bin/bash
root=~/your/path/goes/here/
mission=$1
year=$2
# Set working directory to the specified root [data] directory.
cd $root
# Remove any existing temporary image symbolic links.
# Generate temporary image symbolic links to requested static image files,
# then generate animation from the sequentially numbered temporary images.
rm /tmp/img???.png
x=1; for i in ./$mission/$year/???/${mission}_data_${year}*.png; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".png; x=$(($x+1)); done
ffmpeg -f image2 -r 6 -i /tmp/img%03d.png -b 3200k -y ./${mission}_${year}_data.mp4
# Set working directory back to original location.
cd -
|
|
|
Re: How 2 show animations. [message #79476 is a reply to message #79473] |
Fri, 02 March 2012 11:24  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 3/2/12 12:17 PM, David Fanning wrote:
> Brian J. Daniel writes:
>
>> The IDLffVideoWrite object was introduced in IDL 8.1. IDL 8.0 doesn't have it. My two cents, go with FFMPEG. Here's a site for useful commands (Note: Not my site. I don't love cats that much!)
>>
>> http://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-n eeds
>
> For some reason, which I can't put my finger on at the moment,
> I thought the IDLffVideoWrite object was built on top of FFMPEG.
Yes, from the docs on IDLffVideoWrite:
"IDL uses the open-source library FFmpeg to handle video and audio
compression and file formats. Because of patent issues, the version of
FFmpeg that comes with IDL includes only a select subset of the codecs
and formats that FFmpeg is able to support. However, IDLffVideoWrite can
accommodate other versions of FFmpeg if you replace the version
installed with IDL."
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
|
|
|
|
Re: How 2 show animations. [message #79478 is a reply to message #79477] |
Fri, 02 March 2012 10:59  |
Christian
Messages: 11 Registered: March 2012
|
Junior Member |
|
|
On Mar 2, 2:58 am, DavePoreh <d.po...@gmail.com> wrote:
> Folks
> hi,
> I have 52 images (in .png) format and i would like to make it like
> animation in IDL. can anyone help me.
> Thanks for any advice,
> Cheers,
> Dave
FFMPEG seems to be getting a lot of press, but if it's more "cartoon-
like" and less "movie-like" (and assuming you've given up on using IDL
and want to use the command line) probably you'd prefer it to be in an
animation-oriented format (like .gif). That will be easier to embed
into things (websites, presentations, etc) later as well because it
will play natively in/on almost everything.
In that case imagemagick would be the way to go. It is a collection
of image manipulations commands, which is installed by default on most
linux distributions and is also available through macports. If you
have it installed the command to use would be something like:
convert -delay 50 *.png timelapse.gif
http://www.imagemagick.org
|
|
|
|
Re: How 2 show animations. [message #79488 is a reply to message #79484] |
Fri, 02 March 2012 06:15  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
DavePoreh writes:
> I have 52 images (in .png) format and i would like to make it like
> animation in IDL. can anyone help me.
If you have IDL 8, the IDLffVideoWrite object produces
animations in mpg4 and avi format that don't look so
bad. You can specify which Codec you want to use to
build the animation, and so on. Quite a few features.
Here is a very simple example that makes an AVI movie of all
the PNG files in the current directory. Presumably, you
have named them in a sensible way. :-)
;--------------------------------------------------------
PRO Movie_Example
Compile_Opt idl2
; Open the video recorder.
video_file = 'movie_example.avi'
video = IDLffVideoWrite(video_file, Format='avi')
; Configure the video output for the PNG files you
; plan to add.
framerate = 5
xsize = 750
ysize = 600
stream = video.AddVideoStream(xsize, ysize, framerate)
; Get the files.
files = File_Search('*.png', COUNT=fileCnt)
FOR j=0,fileCnt-1 DO BEGIN
; Read the PNG file.
image = Read_PNG(files[j])
; Save the image in the video stream
void = video.Put(stream, image)
ENDFOR
; Clean things up.
video.Cleanup
END
;--------------------------------------------------------
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|