it’s been some time since I last posted – Spring is always a busy time. I’ve been printing little gadgets and other stuff, some of which you can find on my account at Thingiverse.
But now it occurred to me to create little tutorial on basic video editing using Blender. Most people don’t know that Blender comes with a very handy and complete video editor, with which you can edit both sound and silent videos. I’ll start with a silent one, which I made using my late father’s 1962 vintage Bolex D8L camera featuring 4 minutes of live action per roll of film – planning ahead of shooting is a must. The clip is below, it is an excerpt of the full 4 minute film that I wanted to share with the pilot and my friends on Facebook.
I buy my stock film from Wittner Kinotechnik in Germany, who have a full service including development. When I have received the developed film, I usually watch it once with my trusty Bolex projector to see how it turned out, then send it out to Mediazoo to have it scanned into digital format. This is the stage where Blender comes in handy.
Blender has a set of predefined screen layouts, which you can access from the top of the screen, in the Info window.
When you open that list, you can see that Blender has preset screen layouts for 3D View Full, Animation, Compositing, Default, Game Logic, Motion Tracking, Scripting, UV Editing and at the bottom, Video Editing. All of these are useful, and you can add your own by first setting up the screen as you like, then clicking on the plus sign in the list, and adding a name for it. I have created a Node Editing setup for working with materials.
This is the Video Editor layout, with the different parts pointed out with color boxes:
Top left, marked in red, is the Properties window. It enables you to set the rendering parameters and other settings related to the rendering of the movie. The green part is the Graph editor, with which you can follow the keyframes in your movie file. Sometimes you need to exchange the Graph editor with the Dope sheet, which allows even better access to keyframes and the things they manage, but more of that later.
The grey box is the VSE window. When you have loaded the movie you want to edit, this window shows your video images, and when you scrub along the timeline, you can see your movie happening in it.
The large blue box contains the second part of the VSE, the video sequencer. This is where you manage the film strips and audio strips, as well as effect strips. You can have eight strips that have content, and with the sequencer you then pick the cameras you want and cut and splice both video and sound.
The bottom part is the timeline, which helps you manage your movie frame by frame. By default it is set to show frames 1 to 250, so when you import your movie, you need to set the last frame counter to the last frame of your imported movie.
The basic workflow is this:
- import your film strip (it can be one of a wide variety of movie files, like AVI, MPEG, or even VOB, the DVD film format)
- set your properties to match the film properties (frame size, frame rate)
- edit the film strips (cut strips, move strips, delete and add strips, for both video and audio strips)
- add effects if needed (fade-ins, fade-outs, cross-fades, audio fades)
- render the movie into images, because rendering directly into a movie file when you have effects is not a good idea
- re-import the images into Blender, because now the images have the effects burned onto them
- render into a movie file, which will bring in audio as well.
I have a 4 minute movie, from which I will edit out everything else but the flight over Helsinki, and add a title image as well as a couple of very easy opacity fades. Let’s add a movie file to the sequencer, by selecting Add – Movie like this:
You will then get one strip (video) if you are importing a silent movie, or two strips (video and audio) if you are working with a sound movie. Mine is silent, since 8mm film is not with sound, but if I wanted to add a music track, I could import a sound file just as I do the video, and it would appear as strip #2 above the video in strip #1. This is how the video looks when imported:
Now you can see a dotted box in the preview window, indicating that it has video information in it, but it is black just now. The strip information is crucial on the right in the strip properties: you can see the image size is 720 x 576 pixels, and for rendering to be 1:1 with the original image size (for best quality), it’s a good idea to insert the same values to the Properties window on the top left. Also, at this time, increase the render quality to 100% because you will forget it later.
Frame rate is now also a good idea to adjust. If you have a sound movie, it is more likely than not that you should set this at 29.97 frames per second. Mine is set at 24 fps, which is a slightly faster speed than the 18 fps I use when I shoot with the trusty Bolex. If you need, you can also fiddle with aspect ratio at this point, but I will leave it at 1. Also, find out the last frame of the movie by looking at the length of the film strip on the right, and copy that number into the timeline’s End frame. Otherwise your movie will only contain the default 250 frames.
With the basics now set, I can go hunting for the clip I want to isolate and render as a separate movie. The seuencer shows only a few seconds’ worth of the movie by default, but when you point at it and scroll with the mouse, you can zoom in and out as needed. I will zoom out so as to see the entire movie, and you can move the whole sequencer by pressing the scroll and dragging left and right:
Now it is easy to grab the green sticker on the sequencer and scrub left and right to find the location. You can of course simply press the Play button in the Timeline, and let the movie run until you find the spot where you want to cut, but I just dragged right until the plane appears. There are also buttons for running forward and backward, as well as for jumping between keyframes, but we have no keyframes now. Then I use the frame-by-frame movement in the Timeline (current frame) to find the exact frame I want to cut at.
To cut at the green line, simply make sure the strip is selected (right-click it), and then press the Cut key, which is K. Now you will have two strips on the sequencer, and you can delete the first one by right-clicking it and pressing X as always. I will do that a little later.
Do the same procedure again to find where you want to cut away the rest of the movie, which you don’t need. I’ll just play out the movie until the aviation sequence ends, pause there, use the frame forward/backward buttons to home in at the cut frame, then press K.
Now I will merely right-click on the two extra parts I don’t need and hit X, then delete the strips. This leaves the last part way to the right from frame 0, but when you select it and hit G, you can move it to 0 by hitting the minus key and then the frame number of the start of the clip. This will fly the strip to the frame 0. You can of course just grab it with the mouse and go left to 0.
I wanted to make a header image for this clip, so I let the movie run until I found a nice image. Then I rendered just that single image and added text to it in GIMP, and then I inserted it to the strip just before the movie clip. Of course, nothing is preventing you from doing a little scene, maybe with animated texts, and then adding it onto the VSE just as you could add an image, but this time I decided to do it this way. This is the image I rendered out from the middle of the clip:
I wanted this to be visible for six seconds, so I moved the film clip to the right 180 frames to make room for this. Just hit G and then type 180:
I have also moved the playhead to frame 1. Now, I will insert the image, which is already of the right size for this use. It will have a default length of 26 frames, but I will extend that to 179 using the Length variable on the right hand side of the sequencer.
This is now renderable as a movie, since we don’t have any fancy stuff such as effects, but as I want to use fade-in and fade-out between the title image and the movie itself, I will insert the effects now, render into an image set, then re-insert the rendered images and render the final movie only then. Trust me, this makes for better quality.
To do fade-ins, it is amazingly easy to insert keyframes. You can insert a keyframe for any variable you can use on Blender, and do that for sounds too. So, when your image is fully visible, its Opacity value on the right side of the sequencer is 1, and when it is fully dark, it is set at 0. This enables you to go to any frame you want to start the fade-out, insert a keyframe with opacity still at 1, then move to the frame you want to be full dark, set opacity at 0, and insert a keyframe. Blender will calculate opacity values for the frames in between to make it a nice smooth fade-out.
Fade-in is correspondingly started with Opacity set at 0, insert keyframe for it, and after a few frames, set Opacity to 1 and add another keyframe. Tke keyframe is inserted merely by right-clicking the Opacity field, and selecting Insert keyframe:
I then go to the frame between the title image and the movie itself, and set Opacity at 0. The preview image goes dark, and I can issue a keyframe again:
After the insertion of the second keyframe, there will be a sloping figure shown in the Graph editor, which represents the descent in opacity from 1 to 0. You can adjust how steeply it goes by adjusting the handles in the Graph editor. This is a close-up of the Graph editor after the second keyframe insertion.
When we do it again, for the other clip, we need to fade in. Therefore the first frame of the clip must be turned into Opacity 0, then a keyframe inserted, and maybe 10 frames later, Opacity set at 1 and a keyframe inserted. Blender will interpolate the values between 1 and 0 between the keyframes. After this, the transition images in the video will look like this:
To do an initial fade-in, or a final fadeout, just do the same with the keyframes.
Of course a fade to black is not really interesting, but since it is the basic technique in transitions, I used it here. There are numerous other transitions available, such as the gamma cross, where images will fade in and out on top of each other and not via black, but I will cover that later.
So now all that remains is to check the render settings (make sure the render size is 720 x 576 pixels, frame rate a suitable 24 fps, and image quality is set at 100%.) and also check that all frames will be rendered. Merely take the scrubhead to the last frame and note the frame number, and copy it to the End frame setting.
It’s a good idea also to check the output options:
The Output folder should be a blank one, and when you click on the Folder icon on the right, you get to do just that in Blender’s regular File view window. You will wind up with as many frames as you have in the timeline, so having an empty folder makes the next step easier. Also add a file name after the last in the folder name. PNG is a good alternative at this stge, because it is lossless. When you have done this, run the Animation render with the button in the Properties window.
Blender goes to work now, and drops the movie as separate frames into the folder you just specified. At this point you can save your work that has the fancy fades and all, and return to it later – get a blank file for the final assembly into an AVI or MPEG file. This removes the need to get rid of any keyframes, since you won’t be needing any in the final phase.
So, get a blank file, go into the Video Editing layout again, and select Add – Image from the menu. You will see the directory where you dumped the frames, and when you press A to select all, and press Add Image Strip, they will be inserted into the sequence editor.
And this is the sequence editor when you add them:
When you now scrub with the playhead, you will see the fade effect in the area of frames you used it in. Ah, also – readjust the Resolution and Quality values to 720 x 576, and 100%, because this is a new file. But now we can create the AVI or MPEG file.
Go to the Output part of the Properties, and select the file format you want to use. I picked MPEG for this example.
The Encoding needs to be adjusted only if you have sound in your movie, in which case you would pick an audio codec and set the bitrates. They affect file size as well as quality. But for now, just type the final file name, also adding the .mpg for MPEG or .avi for AVI, and run the Animation render again. This time you will find a movie file instead of a bunch of images. Test it and share to your friends.
I hope this was useful – next time I will add sound to a movie and do crossfades too. But that may take some time, now that Summer is upon us. Enjoy your Summer!