Overlay animation on live video

  13 years ago

Here's just one method I've tried successfully (through some trial and error) to place animations into live video.


Step 1: Create the live video file.

You can use any video you can get into your computer, be it a YouTube video (using Easy YouTube Downloader Add-On for Firefox, for example), a webcam import through Cheese, or imported video from your digital camcorder, cell phone, or digital camera.

Step 2: Create the Flash (SWF) file.

While there is really no option for creating Flash animations natively in Linux, the next best thing might be 3D Flash Animator (www.3dfa.com), which runs perfectly in WINE. You might also do this with Blender or other Linux-native animation program, but that's not what I did here.

IMPORTANT! Make sure to place a solid green ($00FF00) color in the sections of your animation where you want the live video to show. The animation or images you want to be in front of the live video should be any other color but $00FF00 green. If you have to use green in your video, you can set the animation background color to something other than green, but you must adjust it to match in the Chroma Key settings later.

Step 3: Turn the SWF file into a video file.

Since there isn't anything on Linux that will convert SWF (that I can find), use xvidcap or gtk-recordmydesktop to capture it. Xvidcap is better if you turn off Compiz. It can go straight to mpeg or avi and more accurately adjust the section of the screen to record. However, with Compiz turned on, the selection frame puts a shadow around the edge of the section you are recording. As gtk-recordmydesktop offered a nicer interface and didn't have to get into my Effects settings, I chose that.

Load the SWF file into a web browser, then set the screen capture frame to the edge of the animation. Start the recording and quickly hit reload on the web browser. Once the animation is finished, stop the screen capture. Don't worry about how much extra "stuff" you have recorded before and after the animation sequence is played. Later, you can clip the unwanted beginning and ending segments out with a video editor (like OpenShot).

Step 4: Convert formats, if necessary.

Gtk-recordmydesktop only outputs to ogv files, which OpenShot didn't like (extremely distorted image). If this is the case, use a program such as Arista Transcoder to get it into a usable format.

Step 5: Use OpenShot (or your favorite alternative) to Chroma Key and overlay the videos.

  • In OpenShot, you import (or drag-and-drop) the live video and the animation video into your Project Files section.
  • Drag those onto individual tracks.
  • Use the razor tool to trim off any unwanted segments of your videos. Do any other editing you feel necessary.
  • Click on the Effects tab and drag the Chroma Key effect onto the animation video.
  • Right-click on the animation video and select Properties.
  • Click the Effects tab in that dialog and select Chroma Key.
  • If you used a color other than $00FF00 green in the background of the animation, adjust it in this dialog. You can set the hexidecimal code if you know it, or use the dropper tool to pick it up directly from the animation video.
  • Adjust the Variance to make the Chroma Key effect look its best, clicking Play under the Preview after each adjustment to check it. When satisfied, click Apply.
  • Preview and adjust your complete video, editing/moving it as needed.
  • When finished, save it and export it to your prefered video format.

As I said, this is just the way I accomplished this task. There may be something better, so please let us all know if there is!

zaenal1234 12 years ago

i like tutorial for editing video.

mikefreeman 12 years ago

Also, as I said in the tutorial, this is simply how I accomplished the task. If there is a better way to do it, I would love to hear about it!

mikefreeman 12 years ago

Before you can overlay an animation on top of live video, you have to have your live video in your computer, right? I simply included that process in the tutorial for those who don't know how to do it. I don't see how that's contradictory. Can you please explain your concern more in-depth, maybe?

thx1138 12 years ago

Having a headline like "Overlay animation on live video" and talking about "Create the live video file." in the very first step sounds contradictional.
I'm pretty sure you can do everything you are talking about with apps like Cinelerra and Kino. Or am i missing something?