PapaJohn Productions

PapaJohn's Newsletter #5 - June 12, 2004

Picture in Picture


Some want a logo in the corner of a video. Others want a video on the left with a different one on the right.
Movie Maker 2 has only a single video track and no built-in features to achieve a Picture-in-Picture effect without resorting to a custom effect or transition.
You can purchase or use Adobe Premiere or other software to more easily achieve such effects.... but my newsletter and website is mostly about Movie Maker 2, not Premiere and others. So, even if it takes a bit more effort, let's do it with MM2.
As an intro to this week's newsletter, take a look at this 5 minute movie, as it's what it's all about. I'm working on putting together a video from some footage of the Grand Canyon that I took in April. Here's the link:
You may have seen some posts on the newsgroup or in forums about doing a Picture-in-Picture by using a custom transition. Or maybe you saw the notes on the Editing > Video > Transitions page of my website. That's how this video was made. I'll go through it in detail.
I work with NTSC settings. If you use PAL, your pixel dimensions may be different than those I note.

Special Notices
Here's a couple items before continuing with the weekly topic:
For the rest of this month, I'm giving priority to finishing the 14 Movie Maker hacks I'm writing for a new O'Reilly book about Windows Media Hacks. If my newsgroups and forum postings seem less, or I don't turn around emails as quickly as usual, please assume it's because I'm in some corner working on the hacks.
The many broken links on my website that resulted from the change of server have been fixed, at least all that I can find.... so one that doesn't work should now be rare.

Picture-in-Picture Tutorial
Let's get into it.... we'll start with a project plan, making notes about what you want to achieve, and then get into the steps to implement it.
Make a Project Plan
Here's the plan I made for the Grand Canyon footage.
I thought that showing it as one long video would be boring, as much of the footage was of the canyon itself without much movement.
I'll make it more interesting by playing 3 videos in parallel. Viewers can look at whichever of the 3 they want to, or scan from one to another.
My camcorder footage was shot in widescreen mode on my new Sony TRV80, so I chose the widescreen 16:9 aspect ratio for the final movie, and did a layout of the 3 videos to determine the exact positions I wanted to use.
To do the layout, I opened Windows Paint and used Image > Attributes > to set the image size to 720 pixels for the width and 480 pixels for the height. That gave me a blank canvas sized at 720x480, aligning it with the pixel dimensions of a widescreen NTSC movie. I found through testing that the 720x480 video clip sizes work well for the custom transition I'm using (640x480 works fine too if you're doing standard aspect ratio).
PIP - Project Plan
I copied a few images into my Windows Paint canvas.... actually I used the same picture 3 times, resizing and moving each as I brought it in. It was just to lay them out where I wanted them to get a feel for a pleasing layout.
I opened the picture in IrfanView, sized it to something about what I wanted, maintaining a 16:9 ratio, and then copied/pasted it into Paint.... 3 times, once for each of the 3 video positions. I made the upper left and the right side videos the same size (360x240 pixels for each - 1/4 size of the overall canvas), and the lower left one a bit smaller (306x204 pixels - note that it's 16:9 ratio). That left some room at the upper and lower right for some title text, and some narrative text (you can see in the movie that I did the title but not the narrative text yet).
After settling on the locations, I determined the exact pixel positions of the upper left corner of each of the three videos.
Paint has a neat cursor locating feature which I point out in the above figure. I circled the location of the mouse pointer in the snapshot - you can see that Paint is telling me the position is currently 470 pixels to the right of the canvas' left edge, and 66 pixels down from its top. By using the mouse cursor on each of the upper-left corners of the videos and making notes, I fixed the positions of the videos as:
With Paint and a few images, laying out the planned PIP video positions was easy. Then, after some more thinking about the project, I ended up with this final plan... the ingredients of the visual, and the sequence of putting it together (knowing that plans are made to be deviated from at any point in the process):
That would fill the 3 main areas of the final movie. So I made 7 individual projects to put the raw footage together into better clips.
Then I studied the total running times of each segment to figure how they would best fit together. I wanted roughly equal running times for the 3 videos. The length of each was a big factor in determining which one went where.
Besides that I had to plan, or at least think about:
The movie would need to be done in several passes, using a custom XML file for a special transition to achieve the PIP effect. I'll render each pass at the 'best quality for my computer', knowing that, even with multiple renderings, the final version for web-based viewing will be fine enough.... the size of the WMV files are about 7 percent the size of the DV-AVI files that I would need. Hard drive space on my laptop, where all the work is done, is sufficient, but needs continual management, so going with the WMV files for this project is right, at least for a while.
If I was heading toward a DVD, I'll save each pass as DV-AVI for slightly higher quality.
The planning is done. Now it's time for implementation. I have my 7 video segments finished and ready to use in the larger PIP project.

A - Make the Video for the Upper Left
This step is easy. I took 3 of the smaller videos added them together. I could use some extra time for this video, so I used a couple still pictures (snapshots from the video clips) as long transitions between the video clips. The total playing time for this part is 3 minutes, 55 seconds.
I didn't use any lead-in or closing clips. I'd do that for the overall movie later. I rendered this to a 720x480 widescreen 'best for computer' WMV file.
The video for the right is just one longer one.... it's 3 minutes, 53 seconds, 2 seconds less than the 3 combined segments of step A.... good alignment. It's rendered as a 720x480 widescreen 'best for computer' WMV file.
B - Make the Video for the Lower Left
The last of the three, the one for the lower left, uses 3 video clips with no lead-in, transitions or closing clips.
I muted the audio of the condor footage.... what background audio was on the tape has nothing to do with the condor, so it could only distract from the video. Plus, it'll have music in the background on the final movie.
Implementation 2
The total length of this segment is 4 minutes, 47 seconds, almost a minute longer than the other 2 segments. So the others can start later, or finish earlier... or both. If you noticed in the movie, the two shorter ones stop and hold the last frame until this longer video is close to being finished.
Like the other two, it's rendered as a 720x480 widescreen 'best for computer' WMV file.
C - Overlay the Upper Left Video Onto the Background
I'm ready to put the upper left video in place over the background image. The PIP effect will be done using a custom transition from an XML file.
The background image is 853x480 pixels (I took an MM2 snapshot from one of the working clips - taking it from the clip in the collection for higher quality). I then added 'Grand Canyon' as text on the upper right corner. Use any image app that can add text to a picture. I used Panasonic's MotionDV Studio for this one. If you have Photoshop Elements or anything else that can add text and use a transparent background for it.... use it.
Here's the project timeline view. The project has only two clips. The background picture is first, with a duration of a bit over 4 minutes and 26 seconds..... it's a still picture and I just kept pulling the trim handle on the right to get it that long. I wanted its duration to be longer than the overlying video for the full transition.
The still picture is followed by the video for the upper left. My PIP-720x480-widescreen transition (see below) is then used between the two, and I overlap the video and still picture as much as I can.... the extra 8-1/2 seconds of the still picture that precedes the start of the video will be trimmed off later as needed. Extra leader and finishing frames at this point might come in handy later on.
Implementation 3
The XML File - My PIP-720x480-widescreen Transition
Let's take a close look at the XML file I'm using.... as it's key to using Movie Maker 2 to do Picture-in-Picture videos such as this.... it's not a standard part of Movie Maker 2 or any third-party transition packages.... maybe with the exception of Rehan's beta utility that he is currently offering and some are looking at.
I want to give credit to Ken, who got me started with PiP with his December 2003 newsgroup post of an XML file. It's the one I'm using for this video.... there's a link to it on the Editing > Video > Transitions page of my website, toward the bottom of the page in the section about Picture-in-Picture Transitions.
Here's how you read, tweak and use the XML file. I'm attaching a copy of my file to this newsletter, but changing the .xml extension to .xm_ to make sure it's not filtered out in the email distribution process. Rename it at your end so it reads .xml. You may or may not get the file... Outlook deleted it from my other computer and told me it might have malicious code If you don't get it at your end, you can create your own by copying/pasting this code into a file named PIP-720x480-widescreen.xml:
Version="1.0" >
      <TransitionDLL guid="{BB44391D-6ABD-422f-9E2E-385C9DFF51FC}">
         <Transition name="PIP-720x480-widescreen" iconid="88">
            <Param name="SrcOffsetX" value="0" />
            <Param name="SrcOffsetY" value="0" />
            <Param name="SrcWidth" value="720" />
            <Param name="SrcHeight" value="480" />
            <Param name="OffsetX" value="16" />
            <Param name="OffsetY" value="263" />
            <Param name="Width" value="306" />
            <Param name="Height" value="204" />
Put the XML file in your c:\Program Files\Movie Maker\Shared\AddOnTFX folder.
I don't use multiple PiP Widescreen XML files. I prefer to use just two of them, this one for widescreen more and another for standard 4:3 aspect ratio work. I tweak them as needed.
Anatomy of the PIP XML File
Here's how to read and tweak the file:
If I was using it for my upper left video, I'd make the four lines read 16, 13, 360, and 240. That's the offsets to the right and down, followed by the width and height of the video to be inset.
I rendered the movie to 'best for my computer' - widescreen 720x480 WMV.
Important Notes
Important Note 1: Movie Maker 2 reads the contents of the XML files as it boots up.... so, if you have MM2 running and tweak the file, it won't take effect until the next time you startup MM2.
Important Note 2: Movie Maker 2 copies the XML setting info into your project file as the transition is added. If you close MM2, tweak the XML file, restart MM2 and re-render the project.... it won't change a thing. You have to replace the transition that you embedded in the project with a new one for the settings already embedded in the project to be changed.
Important Note 3: Previewing the project with the PiP transition applied won't show you what you'll end up with... have faith and render the movie.... it'll be there in the playback of the rendered movie. If it's not, or it isn't what you expect, then assume you didn't do your calculations right, or your XML file tweaking. I've yet to see it being MM2's fault when mine doesn't work right.
D - Overlay the Video at the Right
The first upper-left video plays fine.... boosting confidence in the process. It's time to add the second video.
There will be a twist to the approach for this layer... for the audio.
Having tweaked the XML code to set the stage for adding this one, and rebooting MM2 to make sure it uses the right settings, we're all set to put the project together.
Here's what the new project looks like. Instead of a video clip over a still picture, it's now a video clip over another video clip, the one rendered in step C.... that's where things change for the audio.
See from the picture that I've muted both of the audio tracks that are in the timeline with the video clips.... that's because a 4 minute overlapping transition results in the audio of the first clip slowing fading out over that duration, and the audio of the second one slowly fading in.... I don't want that!!! I want the audio of each clip to play at full and equal levels through the entire project.
By putting the two audio tracks on the Audio/Music track and doing the same overlapping there, both will play at full levels through the entire rendered movie.
Implementation 4
Important Note: Overlapping audio on the Audio track of the video results in the audio fading out and in.... Overlapping audio tracks on the Audio/Music track produces parallel running audio that plays at full levels.
I rendered the movie, again using 'best for my computer' - widescreen 720x480 WMV.
E - Overlay the Video at the Lower Left
Now we're in the swing of it, having passed the mid-point and seeing 2 of the 3 videos.... tweak the XML settings for this third video, do the overlapping and note that we're into another case of two overlapping videos with audio, so we do the overlapping audio on the Audio/Music track and mute the audio directly associated with the two videos.
Implementation 5
Render this new pass, again using 'best for my computer' - widescreen 720x480 WMV.
This is the final step to add the 3 videos into the project.... you should now be seeing all 3 playing in parallel, and feeling pretty good about it. It's really not hard to do... just takes a bit of learning and trying it.
F - Finish the Project by Adding Opening and Closing Clips, Music and More Text
We have a single movie file with all 3 inset videos playing. It has some extra leader and ending frames to help with the trimming processes during the final editing.
In this step, I'll add project-specific opening and closing clips, add music and some title overlays.
For the music, I noted the points in time that the 3 main segments in the videos changed. I went to get some appropriate background music. Pinnacle's Studio 8.8 includes Western and classical background music and it's music generation feature lets me specify the exact duration of the piece. It makes the music with an opening, middle and closing.... (there's a link to purchase Pinnacle Studio from Amazon on the CD Burning > Pinnacle page of my website)
But your music can be anything from any place.
I don't need to cover the title overlays..... standard MM2 options. I used them for the opening and closing clips.... I was experimenting with five others used over the videos when I took this screenshot, but I've deleted them since adding the 'Grand Canyon' text to the background image.
Implementation 6
One final comment about the project picture you see above. Why the split in the main video clip at the 28 second spot?? Well, last week's newsletter was about using MM1 and MM2 together, and in the process of putting this video together I bumped into a perfect situation to use them both.
When viewing the final-final movie I noticed a whitish 'blip' at about the 28 second spot. Going frame by frame at 15 fps in MM2 showed nothing. So I looked at it in MM1 and at 30 fps, the frame by frame check showed a single frame that was out of place with the  two surrounding frames, resulting in the quick blip. I noted the exact frame and, back in the MM2 project, I cut it out by lopping off a single MM2 working frame (1/15 second). The video and audio before and after the surgery was fine, so I didn't need to do any more.... that's why the split at that point.
G - Finishing the Music and Text, and adding Narration
I'm still working on this project.... but this gets you far enough to understand how I'm doing it.
I captured the Pinnacle generated music using the Stereo Mix option in MM1's narration capture wizard, creating WAV files. That's what you currently hear in the movie. I'm thinking of tweaking the music a bit...
I'm also thinking of additional text effects, and of adding some narration. But this is plenty for this newsletter. Hope you enjoy it.

I look forward to any discussion items at the forums, and whatever the next topic(s) will be.