This is an example of a workflow for stitching multiple 4k video files together for playback in Previzion as video backgrounds. Different software and cameras can be substituted.
Notes: Multiple 4k h.264 videos will not play back perfectly in sync, and may have slightly different start and stop times.
Software used in tutorial:
- PTGUI Pro
- Quicktime Pro
- Adobe After Effects
- After Effects Plug-in: “SplitImage”
We shot our background with a single camera mounted nodally and panned to 3 positions However, multiple cameras shooting simultaneously could also be used. There are advantages and disadvantages to both, and you will need to weigh them for yourself.
- Lower Cost.
- Lower equipment footprint on location.
- Able to shoot without parallax (nodally).
- Camera color should match between shots.
- No settings to match between cameras.
- Things will not be able to cross seamlessly from one background to the next.
- Takes longer to shoot once set up.
- Lighting may not match between cameras if the plates are long enough.
- Reduced shooting time.
- Things can cross from one camera’s frame to the next if they are far enough away.
- Can be expensive.
- Parallax will not be perfect.
- Requires multiple cameras to have same lens and same settings.
- Requires genlocked cameras for best temporal accuracy.
If using multiple cameras to capture the background be sure you are far away from any elements which can disappear when they cross from camera to camera. Also have a look at our guide on capturing background plates and at PTGUI’s video on shooting panoramas.
Make image sequence
Cut off the beginning or end of clips to make them the same length, if you are working with multiple cameras now is the time to make sure your clips are in sync before exporting the image sequences. When you export image sequences from each clip make sure to add “leading zeros” or “padding” so they will sort properly.
Make sure that your images for each frame are grouped next to one another when sorted alphabetically.
You want them to look like this:
Stitch panorama in PTGUI
Stitch the first set of images, and then save a PTGUI project file. PTGUI has a demonstration video which covers the basic stitching operation of their software.
Set up batch stitch in PTGUI
Open “Batch Builder” from PTGUI’s “Tools” menu. Under “Use Template” select your project file.
Now click “Generate new projects…” Your method will be “Multiple panoramas per folder with a fixed number of images.” Select your folder with all of the images, and tell PTGUI how many images to look for in each panorama. In our case we use 3 images.
Click “Generate Projects,” and then click “OK”. The batch stitcher should open and start stitching images. The batch stitcher should also generate a .pts panorama project file for each group of images. You will need some of these .pts files later.
Import batch stitched images into After Effects
First copy all of your newly created “Panorama.jpg” files to their own folder.
Import all of your Panorama.jpg files as a JPEG sequence in After Effects.
In After Effects create a new composition with the following settings:
- Width:4096 multiplied by the number of videos you want to output (ex. 3 videos = 12,288)
- Frame Rte:23.976
Setting 23.976 as the frame rate is important. Even if your footage was shot at a different frame rate, or you plan on outputting at a different frame rate you must enter 23.976 in order for Adobe’s h.264 encoder to be able to output 4k h.264 files. Since Previzion always plays back video files at the same frame rate as Previzion is set to, the composition frame rate doesn’t really matter. For more information read up on H.264 Levels
Splitting your panoramas in After Effects
The After Effects plugin called “SplitImage” makes splitting your large panorama image sequences into even 4k sequences. Once SplitImage is installed, select your composition with the panorama, then go to “File > Scripts > Splitimage” enter the number of columns you want to split your composition into and hit “Execute.”
Play back finding corrupt images. Find and re-render in PTGUI
This next step is very time consuming, but necessary. For an unknown reason PTGUI outputs an occasional corrupted image. These corrupted images will frequently stop your render, as well as be very noticeable in playback.
Start by rendering one of your newly split panoramas, and where it stops there is likely a corrupt image. I recommend rendering in ProRes format for this part so you can open the video file and see the frame that stopped the render.
ProRes also seems to render faster than H.264. You can open the automatically generated PTGUI .pts panorama file associated with the corrupted and re-output the Panorama.jpg file, then replace the corrupted .jpg in the panorama sequence folder. Now try rendering again until it stops. Repeat these steps until you can get a full render for one of the splits of the panorama segments.
It is a good idea to watch through this sequence before rendering the other two, because occasionally a corrupted image will not stop the render, and any missing frames from the image sequence will also interrupt the video as well. Once you have a single section of the panorama sequence playing back properly move on to exporting all of the sections as h.264 files.
Q: My render keeps stopping in the middle.
A: You most likely have a corrupt panorama JPEG in your image sequence.
Q: My h.264 render fails.
A: As of writing this, Adobe After Efects only supports a maximum h.264 profile of 5.1. This means that h.264 with a resolution of 4096×2160 has a maximum framerate of 28.5fps. Either create a new comp with a lower frame rate, or output ProRes, and compress in HandBrake.