Cinelerra Motion Stabilization – The Forgotten Guide

Have you ever wanted to fix shaky video footage just like the pros? Cinelerra has a video effect that can take jerky camera footage and clean it right up. It can take a while to learn because understanding what it does and understanding how to actually apply it are two different things. The good news is, if you just want to get good video stabilization, there is a way to set it up so that it will work properly the vast majority of the time.

I’ve found this method of Cinelerra motion stabilization to be the most accurate.  Other websites show methods for trying to stabilize on a small area of the footage but I’ve found that using a much larger area produces far more accurate results with almost no fuss.  It does, however, take a much longer time to compute.

Set Up the Video Clip
Create a new video track. Create new audio tracks for as many audio channels as you need. Arm  only these new tracks. Make only the new video track playable . Go to the beginning of the timeline and paste one of your clips from the Clips folder of the Resources window. Turn off keyframes . Set the In/Out points at the beginning of the clip and the end of the clip. Right-click on the track and choose Resize track. In the Scale boxes enter 1.2 and 1.2. Under the Settings menu, choose Format and enter 1.2 for W Ratio and 1.2 for H Ratio. Under the Settings menu choose Preferences and go to the Playback tab. Under Video Out, check Play every frame. Rewind  to the beginning of the track.

We added 20% to the width and height of the track by scaling to 1.2 and 1.2, respectively. Since the track would then be larger than the project, we scaled the project by the same amount. By scaling up the track, we give the Motion effect the room to move the video around to stabilize it.

Set up Motion Effect
Right-click on the video track and choose Attach effect. Select the Motion effect and add it to the track. Now the effect is on the track so open the effect’s controls . You’ll now have a box with a lot of controls, dials, dropdowns, and checkboxes in it. First, choose Do Nothing under Action. This effect can be really slow, so it’s better to have it Do Nothing while you set it up, then turn on the action that you want. For Calculation, set it to Save coords to /tmp which will keep track of the coordinates so that we can use them later. Check the Draw Vectors box. Check Track translation and uncheck Track rotation. Block X and Block Y determine where the effect starts from and since we want to start from the center, they should both be 50 as in 50% position of width/height. Set the Maximum absolute offset to 10 which restricts the effect so that if you have a wide panning motion, the effect won’t try to move the entire video off the screen, it will only move it up to 10%. Make the Settling speed 10 which determines that over time, even if the picture has been moved off center, the picture will be reset back to the center of the screen. Set the Translation block size width and height to 70% and 70%. This is the area that the effect will be tracking. Set the Translation search radius width and height to 12% and 12% which sets the area to search in. Check the Previous frame same block option.

The effect will now check the Translation block area of the previous frame, and look to see if it can find a match within the Translation search radius. For Translation search steps determines the accuracy with which the effect works. Usually, even an accuracy of 128 or 64 is enough to work properly when using such a large Translation block size. Now set the Action to Stabilize Subpixel to enable the effect.

Make sure that you Rewind  and the play the clip. It will play very slowly, but it will stabilize the video and save the results so that we can use them later. In this way you will be able to preview the effect and see how well it works before you render it.

Play Back Motion Effect
When the clip is finished playing, turn the Motion effect off . If you leave the effect on and inadvertently move to any point in the clip, the effect will recalculate at that frame, which may not be what you want. Go to the effect’s controls  so you can set it up for playback only. Set Calculation to Load coords from /tmp and the effect will use the calculations that have already been saved. Turn off Draw vectors. Turn the effect back on , rewind  to the beginning, and play the clip.

Render Video to New Track
Add a new video track and name it Stabilized Clip. Arm only the Stabilized Clip track. Rewind to the beginning of the track. Go to File, Render, and render only video in the Quicktime for Linux File Format. Configure video compression  and choose RGBA. Use Paste at insertion point for the Insertion strategy. Save the file as stabilized-clip.mov and render it.

More Information on Motion Tracking
If you want more information on motion tracking, see the Secrets of Cinelerra – Motion Tracking for details.

Example of Motion Stabilization

Cinelerra Effects / Transitions

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *