Showing posts with label automatic keyframing. Show all posts
Showing posts with label automatic keyframing. Show all posts

Saturday, April 07, 2007

automatic keyframing and the rotate effect

This is the second part of a two-part blog entry on rotating a transparent png in Cinelerra. Since we have created an interesting transparent gif:
http://crazedmuleproductions.blogspot.com/2007/04/transparent-png-as-rotating-image-on.html

Let's rotate it in Cinelerra!

I will do three things in this post:
1) load my project with only one video track, a static png image pulled to a length of 120 frames
2) apply a rotate effect to the track
3) use automatic keyframes to animate the rotate effect

Now, I must admit that I had misunderstood keyframing in Cinelerra. There are a number of ways to do keyframing, but when you work with effects, you will use automatic keyframing. Do yourself a favor and refresh your memory via the manual:
http://cvs.cinelerra.org/docs/cinelerra_cv_manual_en.html or the wiki:
http://cvs.cinelerra.org/docs/wiki/doku.php?id=english_manual:cinelerra_cv_en_17

First, I create a new project by typing "n" using the following specifications:


After we've loaded the project, we will have three preexisting tracks (two audio and one video track). Moving the cursor over any track and clicking the letter "d" to delete the last track on the timeline. We click "d" three times to delete the tracks.

Now, we load the png image I created in the last post noted above:


However, before we add this image as a new resource, a nice feature of Cinelerra is the ability to import images to a specific length onto the timeline. This is configured in Preferences -> Recording. Don't ask me why it is in the Recording dialog, but therein lies the Images section with one checkbox: "Import images with a duration of ." We will change this value to 4 seconds and click OK:


Now we can append the compass png to a new track by pressing the "o" key to Load a new resource. Before we select our png, we make sure to change the Insertion Strategy to Append in New Tracks:


The png will appear on the timeline with a length of four seconds. From the Resources box, pull a Rotate video effect on top of the track. We should now have a screen that looks like this:


We will now rotate our image. To do this, we will learn how to auto keyframe. For automatic keyframing to work, you first must have the little key icon ("Generate keyframes while tweeking") selected in either the project/timeline view or the compositor:


Once the key icon is lit, we will put the insertion point at equal intervals of 0 frames, 30 frames, 60 frames, 90 frames and 120 frames and set keyframe points. To do this, first move the insertion point to the beginning of the timeline, the 0 frame mark. In order to get frames to be the unit of measure on the time bar, cycle through the different time bar measurement options by clicking Shift-click while your mouse is on top of the time bar. Also make sure that Settings -> Align to Frames is chosen.

Once the insertion point is on our first 0 frame mark, go ahead and click the magnifying glass icon on the Rotate effect. The effect shows default degrees of rotation as well as a custom degree text box. Pivot on X and Y coordinates may be selected, but we will not change these values. Draw pivot simply puts a crosshair on the output.

We will keep it simple and set this first rotation point to 0 degrees:


Have the Compositor window showing while you perform the next few rotate keyframes. Repeat this process of selecting a new insertion point and increasing the rotation. Set the 30 frame mark to 90 degrees, the 60 frame mark to 180 degrees, the 90 frame mark to 270 degrees and the 120 frame mark to 360 degrees. As you change keyframes, you should see the output in the compositor change as well. At the end of the process, you should now have a timeline that looks something like this:


Once all the keyframe points are set, deselect the "Generate keyframes while tweeking" icon. We do this so in case we inadvertantly press a key, we don't start generating keyframes unknowingly. After the keyframes are set, set the insertion point back to the beginning of the timeline by pressing CTRL-left arrow and hit the spacebar to replay.

Et Voila! You should have successfully rotated your image! Thank Cinelerra's interpolation engine for the way that the intervening frames are rendered in the video playback. Nice!

Soon, I will post the rendered result for you to compare your results. And in my next post, we'll apply the perspective effect to make the rotate MUCH cooler!

Friday, April 06, 2007

transparent png as a rotating image for video

So I just watched Casino Royale for the third time and I really dug the GUIs they showed at various times during the film. One of the coolest was a graphic of a compass/altimeter as it focuses in on the compound of a bad guy in the Bahamas. I thought that adding something similar to my videos would be damn cool and should be fairly easy to do with transparent gif and the rotate effect in Cinelerra. I didn't know it, but I was about to get a lesson in automatic keyframing of effects, which I've never done before. But first, I will focus this blog entry on the transparent gif creation.

The plan was to get a gif or jpeg image of a compass, turn the background transparent and colorize the black lines of the compass. Later on, we'll rotate the image and fool with the perspective, like this:
Rotating compass
2.7MB

As I am not a very skilled user with Gimp, I thought I would keep my life simple and grab a black and white graphic of a compass off of the web to use as the image to rotate:


I loaded the image into Gimp. This particular image was already a transparent gif, so that saved me the step of adding an alpha (transparent) layer. I then cropped the image to the desired area by selecting the area I wanted using the Rectangle Select (Free Select). I erased the extra bits around the edges using the Erase with a Fuzzy Circle brush with a diameter of 76 pixels:


The large diameter brush was necessary due to the fact that the image was fairly large (1224x1142).

When I looked at the lines of my "compass", the lines appear fairly thin and weak:


Most likely, they would not show up very well overlayed on a video. So I needed to thicken them up. In order to use most of the filters in Gimp, you need to convert the image to RGB. So, I converted the image from Indexed to RGB using Image -> Mode -> RGB. RGB mode enabled me to try out some filters.

To thicken up the lines of the compass, I first used Filters -> Edge-Detect -> Difference of Gaussians with a Radius 1 of 3 and a Radius 2 of 1 pixels. I deselected the invert checkbox. This thickened the lines nicely, but not enough to really stand out. So after playing with a number of filters, I found the perfect one: Filters -> Edge-Detect -> Neon. I left the Radius at 5 and cranked up the Amount to 1.00 to really fatten up those weak, thin lines:

I needed to select a very bright color that would stand out overlayed on a video. To do this, I needed to select all the areas of the same color and drag my chosen color on top of the selected region. First, I chose Select Regions by Color and clicked on part of the compass. This selected all regions of the same color in the graphic. I then chose a suitably bright color for the new color of the compass (#21f811) and dragged that color from the color selection box on top of the selected region:



Finally, as the Neon effect had made the lines a bit jaggy, I deselected my regions of color (Select -> None) then applied a Gaussian Blur of 1 horizontal and 1 vertical pixel using IIR blur method. This rounded those sharp edges, but tended to mute the colors a bit:


I will try to improve the brightness of the selection by using a Neon gradient. That will be a future entry.

I saved the final image as a PNG:


that Cinelerra could import:


Next: automatic keyframing using the rotate effect!