To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.animationOpen lugnet.animation in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Animation / 523
522  |  524
Subject: 
Re: time-lapse
Newsgroups: 
lugnet.trains, lugnet.animation
Date: 
Sat, 19 Apr 2003 13:42:41 GMT
Viewed: 
191 times
  
Hello Todd,

What's a good way to take a whole bunch of frames and string them together
into an MPEG movie?

The source images, once I get them off my camera, will be low-res 1536x1024
JPEGs, each about 500 KB, which I'd like to crop down to 1536x1152 (16:9
widescreen aspect ratio) and then downsample to 768x576 before conversion to
MPEG.

I know how to batch crop and downsample using standard Unix tools like the
PNM utilities, but I don't yet know how to make an MPEG.  I've got an OS X
laptop and a RedHat Linux server at my disposal.  Maybe there's an easy way
using iMovie.

Just to add to the possibilities already suggested by others, QuickTime Pro
can also do it:

- Make sure the images all have the same name and are numbered in sequence
- Open QuickTime Player
- File -> Open Image Sequence (or something like that; I have the German
  version, so I have to guess what the menu command is in the US version)
- Open the first image in the sequence when prompted with the Open dialog
- Select appropriate frame rate in the next dialog
- When the movie is finished, select File -> Export
- In teh Export dialog, MPEG-4 with approporiate options should give you
  what you need.

If you need MPEG-2 or MPEG-1 you will need to use a third party encoder. For
MPEG-1 Toast Video CD might work.

I have used this together with GraphicConverter and the attached AppleScript
to tilt over some digital photos for some of my videos (back with Mac OS 9).

Greetings

Horst





-- for droplet
on open theFile

set thePath to theFile as string
display dialog ¬
    thePath & ".scaled" buttons {" OK "} ¬
    default button " OK "
return

-- Step 1: open the image in GC and get some data about it
try
    tell application "GraphicConverter"
        open thePath without messages -- leave open for subsequent steps
        set theDimension to get image dimension of front window
        set theWidth to first item of theDimension
        set theHeight to second item of theDimension
        set theName to get name of front window
    end tell
on error
    display dialog ¬
        "pic2mov: Graphic Converter cannot open file '" & thePath & "'."
buttons {" Quit "} ¬
        default button " Quit "
    return
end try

-- Step 2: Check, ask, and calculate whether and how it makes sense to use
this image
if number of characters in theName > 24 then
    display dialog ¬
        "pic2mov: Sorry -- cannot work on file names longer than 24
characters. Please rename your file and try again." buttons {" Quit "} ¬
        default button " Quit "
    return
else if theWidth „ theHeight * 768 / 576 then
    display dialog ¬
        "pic2mov: Panning not yet implemented." buttons {" Quit "} ¬
        default button " Quit "
    return
else
    try
        -- scale image to DV horizontal size if necessary
        set theScaleFactor to 768.49 / theWidth as real
        tell application "GraphicConverter"
            -- assume window opened to get original image size is still open
            scale front window horizontal theScaleFactor vertical
theScaleFactor
            set theDimension to get image dimension of front window
            set theScaledWidth to first item of theDimension
            if theScaledWidth is not 768 then
                display dialog ¬
                    "pic2mov: Unexpected image width (" & theScaledWidth &
")resulted from scaling operation (factor " & theScaleFactor & ")." buttons
{" Quit "} ¬
                    default button " Quit "
                return
            end if
            set theScaledHeight to second item of theDimension
            -- try to save some time by not saving resources in tmp. files
            save front window in thePath & ".scaled"
            close front window without saving -- no longer needed, because
we will reopen for each frame
        end tell
        -- select tilt direction
        set theButtonList to {" Top to Bottom ", " Bottom to Top "}
        set theButton to button returned of ¬
            (display dialog "pic2mov: Choose tilt direction." buttons
theButtonList)
        if theButton is first item of theButtonList then
            -- top to bottom
            set theStart to 0
            set theStop to theScaledHeight - 576
            set theStep to 1
        else
            -- bottom to top
            set theStart to theScaledHeight - 576
            set theStop to 0
            set theStep to -1
        end if
    on error
        display dialog ¬
            "pic2mov: Cannot calculate, scale to DV width, or save this
file." buttons {" Quit "} ¬
            default button " Quit "
        return
    end try
end if

-- Step 3: Have GC create an image sequence in separate files
try
    with timeout of 10 * theScaledHeight seconds
        tell application "GraphicConverter"
            activate -- let the user see what GC does
            -- create a series of images with DV vertical size
            set theSuffix to 1
            repeat with x from theStart to theStop by theStep
                open thePath & ".scaled" without messages
                change margins of front window with {0, -x, 0,
-(theScaledHeight - 576 - x)}
                save front window in thePath & "." & theSuffix
                close front window without saving
                set theSuffix to theSuffix + 1
            end repeat
        end tell
    end timeout
on error
    display dialog ¬
        "pic2mov: Cannot create image sequence." buttons {" Quit "} ¬
        default button " Quit "
    return
end try
try -- depending on how we got here, there may not be a front window ...
    tell application "GraphicConverter"
        close front window without saving
    end tell
end try -- ... so we ignore errors here

-- Step 4: Have QT Pro convert the image sequence to a DV stream
try
    with timeout of 10 * theScaledHeight seconds
        tell application "QuickTime Player"
            activate -- let the user see what QuickTime Player does
            open image sequence thePath & ".1" frames per second 25
            export movie 1 of front window to file (thePath & " (DV)") as DV
stream using settings preset "PAL; 48 kHz"
        end tell
    end timeout
on error
    display dialog ¬
        "pic2mov: Cannot convert image sequence to DV stream." buttons {"
Quit "} ¬
        default button " Quit "
    return
end try
try -- depending on how we got here, there may not be a front window ...
    tell application "QuickTime Player"
        close front window without saving
    end tell
end try -- ... so we ignore errors here

-- Step 5: Let Finder clean up temporary files
tell application "Finder"
    -- move scaled image to the trash
    delete thePath & ".scaled"
    -- same loop as for GC, but this time we move sequence images to the
trash
    set theSuffix to 1
    repeat with x from theStart to theStop by theStep
        delete thePath & "." & theSuffix
        set theSuffix to theSuffix + 1
    end repeat
end tell

-- for droplet
end open

on run
    display dialog ¬
        "pic2mov: Drag a picture (in portrait format) on me to have it
converted to a tilting QuickTime DV movie." buttons {" OK "} ¬
        default button " OK "
end run



Message is in Reply To:
  time-lapse
 
I'm taking a 2000-frame (80 seconds) time-lapse movie today of the PNLTC layout at the Oregon Convention Center. What's a good way to take a whole bunch of frames and string them together into an MPEG movie? The source images, once I get them off my (...) (22 years ago, 18-Apr-03, to lugnet.trains, lugnet.animation)

8 Messages in This Thread:






Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR