# Computing Zoom Videos In this tutorial, you will learn how to create Mandelbrot zoom videos using the DeepDrill toolchain. In particular, you will learn how to compute the following video: Unlike calculating still images, creating a zoom video requires a much more sophisticated workflow. For example, multiple keyframes must be calculated and stitched together in the right way. To simplify the process, video creation has been divided into three phases. In the first phase, `deepmake` is used to create a Makefile and a larger number of input files. In the second phase, the Makefile is executed to compute all keyframe images via seperate invocations to `deepdrill`. In the last phase, `deepzoom` is executed to assemble the final video by calculating intermediate frames. ## Setting Up the Workflow We start by creating an empty project directory: ```shell mkdir project ``` To set up a workflow in this directory, we launch `deepmake` with the following options: ```shell ./deepmake bewitched.ini -o project ``` The application first tells you how many files will be created and asks for your permission to proceed: ``` DeepMake 3.1 - (C)opyright Dirk W. Hoffmann 68 files will be created. 0 files will be skipped or modified. Do you want to proceed [y]? ``` After confirming by hitting return, `deepmake` generates all necessary files: ```none Generating zoomer ini file: ................................. 0.00 sec Generating 66 ini files: ................................. 0.03 sec Generating Makefile: ................................. 0.00 sec Total time: 0.04 sec ``` Let's have a more detailed look at the configuration file. Besides providing the location and iteration parameters, the following key-value pairs are defined: ```INI [texture] image = wickerwork.jpg [video] keyframes = 66 startframe = 66 velocity = -0.5 [lighting] enable = true ``` The `image` key in the `texture` defines the overlay image which will be superimposed onto the colorized Mandelbrot set. All video related parameters are specified in the `video` section. The first key in this section specifies the number of keyframes to calculate. The second key advises DeepDrill to start at the last keyframe. The third key assigns a negative value to the `velocity` property which means that the video will be a back-zoom video. A value of 1 or -1 would create a delay of exactly one second between two keyframes. Our video will advance at half that pace, resulting in a total play time of 2:12 minutes. The last key turns lighting on which means that DeepDrill will compute spatial images instead of flat ones. Let's take a closer look at the files DeepDrill created in the project directory: - `deepzoom.ini` This file contains several key-value pairs which will be picked up by `deepzoom` to assemble the final video. It plays no role in the creation of the keyframe images. - `keyframe_0.ini` to 'keyframe_66.ini' These configuration files are used to calculate the keyframes. They are composed out of the configuration files that were passed in as command line arguments when the workflow was set up. - `Makefile` This is a standard Makefile that automatically calculates all keyframe images. In the next section we will take a closer look at its contents. ## Computing the Keyframes For our tutorial project, DeepDrill has created the following Makefile: ```Make # Generated by DeepDrill 3.1 # # Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de # Licensed under the GNU General Public License v3 DEEPDRILL = /Users/hoff/tmp/dd/./deepdrill DEEPZOOM = /Users/hoff/tmp/dd/./deepzoom MAPS = $(patsubst %.ini,%.map,$(wildcard *_*.ini)) VIDEO = deepzoom.mov .PHONY: all maps clean all: maps maps: $(MAPS) %.map: %.ini @$(DEEPDRILL) -b -v $*.ini -o $*.map -o $*_preview.jpg image.width=320 image.height=200 > $*.log %.jpg: %.map @$(DEEPDRILL) -v $*.ini $*.map -o $*.jpg $(VIDEO): $(IMAGES) ``` The Makefile defines two major goals: One is to create the map files from the location files and the other one is to compose the final video. To create all map files, we change to the project directory and run the Make utility: ```shell cd project make -j4 ``` The `-j` option instructs Make to run multiple jobs in parallel, four in this case. Although this option is not mandatory, its use is strongly recommended as it significantly reduces the overall computation time. Depending on the performance of your machine, it may take a while to calculate all images. DeepDrill informs about the current progress by outputting brief status information: ```none [0%] Drilling keyframe_10.map ... [0%] Drilling keyframe_11.map ... [0%] Drilling keyframe_1.map ... [0%] Drilling keyframe_0.map ... [4%] Created keyframe_10.map (12.35 sec) [4%] Drilling keyframe_12.map ... [4%] Created keyframe_0.map (14.11 sec) [4%] Drilling keyframe_13.map ... [4%] Created keyframe_11.map (14.30 sec) [4%] Drilling keyframe_14.map ... [10%] Created keyframe_1.map (26.48 sec) [10%] Drilling keyframe_15.map ... [10%] Created keyframe_12.map (14.96 sec) ... ``` Another way to obtain information about the current progress is to launch `htop`in a seperate terminal window. `htop` is available for all Unix-like operating systems and reports detailed information about all running processes: After completion, the project directory contains a map file and an image file for each keyframe. ## Assembling the Zoom Video The final step is to combine all the keyframes into a zoom video by calling `make` with the `deepzoom.mov` target as argument: ```shell make deepzoom.mov ``` This target executes a separate tool called `deepzoom` which stiches together all previously computed keyframes. After completion, file `deepzoom.mov` will be created, which contains the final video.