Re: MP4/Animated GIF/JPEG woes....(Windows, IDL 8.1) [message #76868] |
Mon, 11 July 2011 11:25  |
Juggernaut
Messages: 83 Registered: June 2008
|
Member |
|
|
On Jul 11, 11:59 am, Daft Pict <brianjmcl...@gmail.com> wrote:
> I've just started collaborating with some planetary astronomers who
> tend to use very different tools compared to us traditional
> observational astronomers :-) It's fun but I'm trying to generate
> products that they use (and I typically don't) and having some teeth-
> gnashing moments and screaming at the IDL help pages....
>
> 1). Creating an MP4 file from a stream of images - seems easy
> according to the help pages and I duplicated the example code. The
> resulting file is playable on my windows box using media player, but
> not when using QuickTime on either windows or their Mac systems.
>
> 2) Animated GIFs again seem straightforward, except that write_gif
> appears to reset my color table so I lose the color in overlays over
> images. I pass in the current RGB values from the common block after
> setting my tables but the gif file is B&W and the RGB arrays are all
> reset!
>
> 3) Even tried animated JPEG since the help pages describes how to do
> it, but the sample code doesn't work as I get an error when trying to
> use the unit option even though it is described in the help....
>
> Venting over - if anyone has some suggestions as to what causes any of
> these problems or have solved these issues, are please let me know
> cheers - Brian
For anyone who doesn't have IDL 8.1 and would like to create high
quality videos...just look at the ffmpeg toolset. It lets you create
a wide variety of encoded video formats and takes something as simple
as a series of images or you can delve into their C++ API to write
your own video creation code.
|
|
|
Re: MP4/Animated GIF/JPEG woes....(Windows, IDL 8.1) [message #76869 is a reply to message #76868] |
Mon, 11 July 2011 10:30   |
Daft Pict
Messages: 8 Registered: March 2007
|
Junior Member |
|
|
I am using IDLffVideoWrite in 8.1 and I tweaked the example code from
the help file.
I'm sure it's something silly I'm doing due to lack of sleep - it's a
FUN project!!!!
here's a code snippet...
<complicated display construction in a loop through all images
omitted>
;----------------------------------------------------------- -------------
; Read back display
rgbFrame=tvrd(/true)
frame=tvrd()
;----------------------------------------------------------- -------------
; First image initialises everything
if (i eq 0) then begin
t=size(rgbFrame)
width = t[2]
height = t[3]
frames = nFiles
fps = 2
; Create object and initialize video/audio streams (make sure earlier
file deleted)
file_delete,movFile,/allow_nonexistent
oVid = IDLffVideoWrite(movFile)
vidStream = oVid.AddVideoStream(width, height, fps)
endif
;----------------------------------------------------------- -------------
; Add display frame to output streams
time = oVid.Put(vidStream, rgbFrame)
write_gif,gifFile,frame,R_curr, G_curr, B_curr,/
multiple,delay_time=100
write_jpeg,jpgFile,rgbFrame,/true
endfor
;----------------------------------------------------------- -------------
; Close the files
oVid.Cleanup
write_gif,gifFile,/close
|
|
|
Re: MP4/Animated GIF/JPEG woes....(Windows, IDL 8.1) [message #76870 is a reply to message #76869] |
Mon, 11 July 2011 10:16   |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
I second, IDLffVideoWrite is the way to go. I recently used it to
create Quicktime-comptatible MP4 files fro a NASA Press Conference.
The example code (with some customization of course) worked
flawlessly. Haje
On Jul 11, 12:29 pm, Michael Galloy <mgal...@gmail.com> wrote:
> On 7/11/11 9:59 AM, Daft Pict wrote:
>
>
>
>
>
>
>
>
>
>> I've just started collaborating with some planetary astronomers who
>> tend to use very different tools compared to us traditional
>> observational astronomers :-) It's fun but I'm trying to generate
>> products that they use (and I typically don't) and having some teeth-
>> gnashing moments and screaming at the IDL help pages....
>
>> 1). Creating an MP4 file from a stream of images - seems easy
>> according to the help pages and I duplicated the example code. The
>> resulting file is playable on my windows box using media player, but
>> not when using QuickTime on either windows or their Mac systems.
>
>> 2) Animated GIFs again seem straightforward, except that write_gif
>> appears to reset my color table so I lose the color in overlays over
>> images. I pass in the current RGB values from the common block after
>> setting my tables but the gif file is B&W and the RGB arrays are all
>> reset!
>
>> 3) Even tried animated JPEG since the help pages describes how to do
>> it, but the sample code doesn't work as I get an error when trying to
>> use the unit option even though it is described in the help....
>
>> Venting over - if anyone has some suggestions as to what causes any of
>> these problems or have solved these issues, are please let me know
>> cheers - Brian
>
> Have you checked out the IDLffVideoWrite class in IDL 8.1? I
> occasionally do animations, but haven't had to since IDL 8.1 was
> released. The What's New says:
>
> "High-quality Video Animations
>
> The IDLffVideoWrite class allows you to write images to a video file,
> with an optional soundtrack. You can create .avi or .mp4 video files
> with the IDLffVideoWrite class. By default, video streams in .mp4 files
> use the MPEG-4 codec, and audio streams in .mp4 files use the AAC codec."
>
> It uses FFmpeg which I have used in the past with great results.
>
> Mike
> --
> Michael Galloywww.michaelgalloy.com
> Modern IDL, A Guide to Learning IDL:http://modernidl.idldev.com
> Research Mathematician
> Tech-X Corporation
|
|
|
Re: MP4/Animated GIF/JPEG woes....(Windows, IDL 8.1) [message #76871 is a reply to message #76870] |
Mon, 11 July 2011 09:29   |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 7/11/11 9:59 AM, Daft Pict wrote:
> I've just started collaborating with some planetary astronomers who
> tend to use very different tools compared to us traditional
> observational astronomers :-) It's fun but I'm trying to generate
> products that they use (and I typically don't) and having some teeth-
> gnashing moments and screaming at the IDL help pages....
>
> 1). Creating an MP4 file from a stream of images - seems easy
> according to the help pages and I duplicated the example code. The
> resulting file is playable on my windows box using media player, but
> not when using QuickTime on either windows or their Mac systems.
>
> 2) Animated GIFs again seem straightforward, except that write_gif
> appears to reset my color table so I lose the color in overlays over
> images. I pass in the current RGB values from the common block after
> setting my tables but the gif file is B&W and the RGB arrays are all
> reset!
>
> 3) Even tried animated JPEG since the help pages describes how to do
> it, but the sample code doesn't work as I get an error when trying to
> use the unit option even though it is described in the help....
>
> Venting over - if anyone has some suggestions as to what causes any of
> these problems or have solved these issues, are please let me know
> cheers - Brian
Have you checked out the IDLffVideoWrite class in IDL 8.1? I
occasionally do animations, but haven't had to since IDL 8.1 was
released. The What's New says:
"High-quality Video Animations
The IDLffVideoWrite class allows you to write images to a video file,
with an optional soundtrack. You can create .avi or .mp4 video files
with the IDLffVideoWrite class. By default, video streams in .mp4 files
use the MPEG-4 codec, and audio streams in .mp4 files use the AAC codec."
It uses FFmpeg which I have used in the past with great results.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
|
|
|
Re: MP4/Animated GIF/JPEG woes....(Windows, IDL 8.1) [message #76952 is a reply to message #76869] |
Tue, 12 July 2011 13:51  |
AndrewM
Messages: 5 Registered: July 2011
|
Junior Member |
|
|
On Jul 11, 11:30 am, Daft Pict <brianjmcl...@gmail.com> wrote:
> I am using IDLffVideoWrite in 8.1 and I tweaked the example code from
> the help file.
> I'm sure it's something silly I'm doing due to lack of sleep - it's a
> FUN project!!!!
>
> here's a code snippet...
>
> <complicated display construction in a loop through all images
> omitted>
> ;----------------------------------------------------------- -------------
> ; Read back display
>
> rgbFrame=tvrd(/true)
> frame=tvrd()
> ;----------------------------------------------------------- -------------
> ; First image initialises everything
>
> if (i eq 0) then begin
> t=size(rgbFrame)
> width = t[2]
> height = t[3]
> frames = nFiles
> fps = 2
>
> ; Create object and initialize video/audio streams (make sure earlier
> file deleted)
> file_delete,movFile,/allow_nonexistent
> oVid = IDLffVideoWrite(movFile)
> vidStream = oVid.AddVideoStream(width, height, fps)
> endif
> ;----------------------------------------------------------- -------------
> ; Add display frame to output streams
>
> time = oVid.Put(vidStream, rgbFrame)
> write_gif,gifFile,frame,R_curr, G_curr, B_curr,/
> multiple,delay_time=100
> write_jpeg,jpgFile,rgbFrame,/true
> endfor
> ;----------------------------------------------------------- -------------
> ; Close the files
>
> oVid.Cleanup
> write_gif,gifFile,/close
I did the development of IDLffVideoWrite. I just did some
experimentation to try and reproduce your problem, and I think I've
got it figured it out. If I modify the IDLffVideoWrite help sample
code to output at any framerate less than 5 fps, Windows Media Player
still works fine but Quicktime just displays solid green. Increase
the framerate to 5 fps or higher, and it works fine again.
If that doesn't do it for you, I'll be happy to do some more
investigation.
|
|
|