NZMac.com - Supporting the New Zealand Mac community : Saturday, 17 May 2008
April stats: 26,112 Visits - 594,859 Hits
Editing Digicam movies in iMovie Print
Written by Rodney Tamblyn   
Friday, 11 April 2003

If you have purchased a reasonable quality digital camera in the last few years you will have probably discovered you can shoot movie files in addition to taking still photos. Despite most cameras only recording movies of very limited duration, it's often possible to capture very effective movies. Using my Sony digicam I find it best to record at the highest size and resolution quality available, in my case this 320x240 pixels in so-called high quality mode. At this setting my camera can record 15 seconds at a time, with each movie file occupying about 5MB. Most digital cameras record these movies using the MPEG1 standard, producing a so-called "muxed" file, where the audio and video are combined together into a single track. However some record in other formats, such as AVI. More on this below.

The problem arises when you want to edit or combine these movies, as many video editing applications lack the capability to handle muxed MPEG1 files. OSX applications like iDVD and iMovie are designed to handle video from camcorders, but wouldn't it be great if you could get those movies from your digital camera into a format these applications understood? Well, by using the power of OSX, Unix open source software and QuickTime movie Player Pro, it's possible.

The old axiom of 'Quality in, Quality out' applies here. You should choose options on your digital camera when you are taking movies to record at the highest resolution and quality you can to get best results. It's better to record several short files at high quality and edit them together later, than one long low quality movie (assuming you have the space available). High quality MPEG1movies captured at 320x240 will produce surprisingly good results once converted.

Before you start
You will need to determine whether the movies your camera generates are MPEG or some other format (typically AVI). The instructions below apply to converting MPEG movies. To determine the format of your movies, look at the file extension. If the file name ends in ".mpg" then the file is (almost certainly) an MPEG file. I recommend that you open a sample movie you've taken in QuickTime Player and select "Show Movie Info" from the "Window" menu. If it says something like "MPEG1 Muxed, 320x240" under Format then the instructions below apply. (If your movie is not an MPEG file, skip ahead to "Exporting the movie" below.)

Getting the software
You'll need to download and install several OSX software packages.

  • Install the Script menu and the QuickTime Player applescripts

    Apple provide a number of scripts to automate actions in QuickTime Player. You can download these scripts from the Applescript QuickTime page.

    After downloading these scripts, you will need to install the Applescript script menu.

    Ignore the instructions that come with the QuickTime scripts for installing the script menu - they are out of date. The correct way of doing it is to drag the ScriptMenu.menu icon, located in the AppleScript folder in the Applications folder, to the menu bar at the top right of your screen and let go. Once the script menu is installed, select "Open Scripts folder" from the menu, and drag the QuickTime Player Scripts into the folder.

  • Install the Mad audio encoder

    Mad is a high quality open-source audio encoder library, which we will use to convert the audio channel of the movies from MPEG1 to aiff. Download the Mad audio encoder. This contains two parts, the Mad.pkg (which installs the Mad unix utilities) and "madplaywrap", a front end application you will use to access these and convert your audio files.
  • MPGTX tools - MPEGtx is an mpeg editor. Since QuickTime Player provides limited support for editing MPEG1 movies we will need this application. Download the mpegtx package. Install the mpegtx.pkg fi

Reviewing the software
MPGTXWrap and the MadPlayWrap provide a graphic user interface "wrapper" to the underlying functionality of the MPGTX and Mad utilities. One of the functions of a software wrapper is to minimise the complexity of the underlying software, and hence open it up to use by a wider range of users, including those who might be uncomfortable using a command line tool. On this score I believe this packages have succeeded well. I think we all should be thankful that people like Philipp Biermann take the time to make this sort of software available to others.

Once you've installed the packages more extensive functionality is available from the command line (using the Console application), but most will never have the need to do this. MPGTXWrap suffers from a slightly cluttered user interface. I think some of the options would be better organised into separate option areas. I found that the drag and drop was sometimes a little unreliable, not registering files dropped, and the file listing area is a little clumsy. However these are very minor criticisms compared to the utility of having the software available. Both installed faultlessly on my system (I'm running OS 10.2.4), installation instructions and comments were clear and easy to follow.

MPGTXWrap and the MadPlayWrap are very specialised applications. You won't use them every day, but it's very convenient knowing they are there when you do need them. They demonstrate one of the great benefits all Mac users are realising from the shift to OSX, the increased availability of powerful open source software utilities, with customised Mac front ends. The free availability of Applescript Authoring Studio and the ability of Applescript under OSX to call shell (unix) commands, has made developing these sorts of wrapper application much simpler. I've even made one myself for an open source mail management package called Zoe.

The QuickTime 5.0.2 Scripts are very useful free automation examples for those of use who would like to get started using Applescript with QuickTime Player. That being said, many of the editing script examples are not terribly useful, still they demonstrate what is possible. The Applets-Droplets folder (also included in the download) is worth a look, and could be very useful for people who work regularly with QuickTime movies and images - e.g."Save as Uneditable", "Prep Camera Images for Web", and "Annotations and Credits Droplet".

A note of caution here. One or two of the QuickTime droplet scripts edit and replace the files you are working with (which is fine), but may behave in unexpected ways (which is not!). Recently I used the " convert to save disabled" script on a folder of movies. The script performed the conversion, but removed the chapter tracks (a special track type which creates a navigational menu) from the movies. If you are using scripts like this one, it would be advisable to work with backups until you confirm that the script is performing as anticipated

From my past experience with these types of scripts, you may well have to edit them yourself to get them to do exactly what you want - use the "Script Editor" application which you'll find in the "Applescript" folder in your "Applications" folder. Installation of the Applescripts could be made much simpler through provision of an installer package. As it is the instructions for installing the script menu are incorrect. It would also be nice to see an update to this package now that QuickTime 6 is out.

mpgtx GUI

The mpgtxwrap GUI application - allows you to take multiple mpg files and have them automatically "joined" into one file.

Convert an muxed MPEG1 movie for editing in iMovie

  • Organise the digicam movies and join together into a single source movie

    It's easier and more efficient to join all the movies you wish to work with into a single file, as this avoids having to duplicate the various editing options, which can be quite time consuming. Step one is to join our MPEG files together into a single movie file, then split this file into it's constituent audio and video components.


    Locate and open the mpgtxwrap GUI application. Drag and drop the movie files you wish to convert onto the window. Click the "File-List" button to see a listing of the files you have added. If you are dragging and dropping several times onto the window, you should select the button "check here for drag-add more files". Once you've got all the files you need added, select the "Join" option and click "Start". The program will create a new single file in the same folder as the source movies containing al the movie files you have added, it will probably be called "chunk.mpg". A special note here: if you have movies shot in sideways (3:4) orientation (that is movies you took holding the camera side in order to get a tall/thin shot) you should import these separately (i.e. don't mix them up with the normal orientation movies) - more about this below
  • Demuxing
    Demuxing is the process of splitting an muxed MPEG movie (containing audio and video mixed together in a single track) into separate audio and video files. Locate the file created in step 1 and drag it onto the mpgtx window (or select "Open File" and locate it).

    Review the file list area to ensure the correct file is listed (you may need to reset the list if the previous import files are still being shown). Select the "Demux" option and click "Start". Mpgtx will break the MPEG file into it's constitute audio and video tracks, and save these out in the same folder as the source file you have selected. The files are by default named "chunk.m1v" (the video) and "chunk.mp2" (the audio).
  • Audio conversion
    In order to get our footage into iMovie we need to convert the audio file (by default named chunk.mp2) into a format we can work with. To do this locate and open the "madplaywrap" application. Drag and drop the chunk.mp2 (or whatever your file is named) onto madplaywrap, it will appear in the Filename window, and choose "AIFF" file format. Click "Start". Messages will appear in the output window at the bottom of the screen as the file is converted. You should now have a file named "chunk.mp2.aiff" in your source folder.
    Mad play
  • Putting it all together

    We are now ready to prepare our movie for export to iMovie. Open QuickTime Player. Close any default windows (empty movies, promotional windows etc). Select "Import" from the file menu (if you don't have an Import option you probably need to update to QuickTime Pro). Navigate to your source folder and select chunk.mp2.aiff. Repeat the process and import chunk.m1v. You should now have a video and audio window open on your screen. Play the files and check that they are OK.

    To merge the two files back into a single file go to the script menu ->QuickTime Player Scripts->Edit and select "Merge movie 1 into movie 2". QuickTime will merge the audio into the video. Choose "Get Movie Properties" from the movie menu - a window will appear showing the properties of your movie. Save your movie (you don't have to flatten it, dependencies are fine).

    Movie to rotate

    Movies from some Digicams may not output to the computer with the correct orientation, but can be fixed using a movie created from a blank image file.

    Dragged image

    Dragging the image onto the blank file and rotating it, produces the final (correctly orientated) movie.

    Finished movie
    Special step for movies requiring rotation
    • The following is a little complicated, so I suggest if it's your first attempt, stick to a normal orientation movie. However once you've got the knack of the process, you will find the following useful.

      These special steps describe what to do if your movie needs to be rotated. This can happen if you have taken a shot holding the camera on it's side to get a tall/thin shot. In the Properties window select "MPEG1 Video" from the left pull down menu. In the right pull down menu select "Size". Click on the rotate buttons to adjust your movie.

      To ensure that the video get's scaled correctly when we export it to DV format, we need to add an image track, to ensure the movie is the right width (otherwise when you export the movie, QuickTime will scale it oddly and you'll end up with a lot of short fat looking video!). Download and open this image in movie player, do this by either dragging and dropping it onto the QuickTime player in the dock, or select Import from File menu in QT Player. This is a 320x320 pixel pict image, which we will use as a backdrop to the movie. (I'm assuming here your movie is 320x240 pixels, if it isn't you'll need to make your own backdrop image in a graphics program of your choice.) Go to the script menu and choose ->QuickTime Player Scripts->Edit and select "Merge movie 1 into movie 2".

      Next we must shift the backdrop image to the back of the movie (behind the video track so it doesn't cover it up). Open movie properties, select "Video Track" from menu 1, and "Layer" from menu 2. Use the arrows to change the Layer Number to 0.

      To rotate the video, select "MPEG1 Video Track" from menu 1 and "Size" from menu 2. Click "Adjust" - notice handles appear around the video track. Click the rotate button to adjust the video track. Click once on the video window to select it, and use the arrow keys (on your keyboard) to shift the video track down so it is centered over the backdrop. Click the "Done" button in the properties window to confirm your changes. Select "Movie" from menu 1, your movie should now be 320x320 pixels.

      Save your movie.

  • Editing movie in QuickTime Player

    If you want to edit your movie in iMovie, skip to the next section.

    Editing commands (cut, copy, paste, track enable etc) are not enabled in QuickTime player when viewing MPEG1 movies. This is normal (well, it has been since version 4). If you want to edit such movies in QuickTime player, you'll need to recompress to a different format. Select Export from File menu and choose "Movie to QuickTime Movie", click Options. Under Video, select either Sorenson or MPEG4 (or some other codec).

  • Exporting the movie to DV

    To prepare your movie for import into iMovie you need to convert it to a DV Stream file. Select "Export" from the file menu. Choose "Movie to DV Stream" from the Export menu. Click "Options" and choose the appropriate format your iMovie project needs. In New Zealand if you have attached a camera to your computer it's is probably set to PAL, however the default (if you've never attached a camera to your computer) is NTSC. For more info, see this tech note on Apple's support site. The audio format doesn't matter, leave it at 32 or change to 44.1. Click OK, name your file and click "Save".

    Your movie will now be converted to DV format, this can take a long time and use a lot of hard disk space. A 30 second MPEG1 movie, which occupies 10Mb may take around 100Mb once converted to a DV stream file. Bear this in mind if you are converting a long movie, make sure you have sufficient space available on your drive.

    After exporting is finished, open iMovie and import your file (File->Import). Your movie is now ready for viewing and editing.
Comments (1)add comment

a guest said: March 24, 2007   Votes: -1

I understand most of what was written (thanks, by the way!). But, my only other question is: how do you make the file smaller, once it's converted (say, making a 100mb file, into maybe a 50mb file)?
 
report abuse
vote down
vote up
March 24, 2007
Votes: -1

Write comment
This content has been locked. You can no longer post any comment.
You must be logged in to a comment. Please register if you do not have an account yet.

busy
Last Updated ( Saturday, 06 January 2007 )
 

Related Articles

Advertisement
Site developed by Bluengrey.com :: Joomla Template by Joomlashack
Joomla Templates by JoomlaShack Joomla Templates by Compass Design