Sunday, November 29, 2020

Editing lecture videos using Davinci Resolve

In my previous post I described a simple workflow for generating lecture videos.  One limitation of this workflow is that when slides are shared as a virtual background in Zoom (which I like to do in order to keep my webcam image on the screen next to the slides), the cursor is not captured in the video recording.  Since I occasionally need to highlight a portion of the image, this means that I need to edit the video files to add that highlighting.  To do this I decided to use DaVinci Resolve 16, which is a powerful video editing tool that is available for free.  It has a bit of a learning curve, but the power appears to be well worth it; here I will show my workflow for adding annotations to a lecture video.  I'm mostly doing this so that I remember how to do it next time around, but hopefully it might also be useful for others.

In this example I am discussing Z-scores, and I want to highlight the location of the Z = 0 (i.e. the mean) and Z =1 (one standard deviation) on the normal distribution.  After opening DaVinci Resolve, I start a new project for my video, which will open a browser for the media in my project.  I then import my lecture video using File -> Import File ->  Import Media; it will ask whether you want to change the video settings to match the current project, which I accept.  The video will now appear in the media browser in the top left; drag the video onto the timeline browser in the lower leftmost portion of the screen, which will add it to your timeline.  Now go to the "Edit" window by clicking the Edit button at the bottom (third icon from the left).  Now you will see your video in the timeline at the bottom, along with a preview window at the top:

Now let's add our annotation. First, find the location in the video where you want to add the annotation.  Then, right click in the area just to the left of the timeline, and add a new track:

Now open the Effects library using the tab at the top of the screen (if it's not already open), and navigate to the Effects panel under the Toolbox option.  You should see an option for "Adjustment  Clip" - grab this and drag it to the location on your video that you had identified.

Then, select and right click on the Adjustment Clip that was just created, and choose "Open in Fusion Page":

This will open the Fusion editor, which is a powerful tool for all sorts of video edits.  You will see a section in the bottom left showing two nodes for MediaIn1 and MediaOut1; what you need to do is add a Paint node into the line connecting those nodes, which you can do by right-clicking onto the line and Adding a Paint tool node:

You will now see details about the Paint tool in the inspector to the top right.  Here is perhaps the most important thing to know here:  The tool that is opened by default (the "Multistroke" tool) doesn't do what we want it to do here, which is to create a graphic that remains on the screen for the length of our Adjustment clip.  To do that, select the simple "Stroke" tool, which for me is the fourth icon in the panel above the preview:

You should then see a set of controls for Stroke1 in the Inspector to the top right:

Choose the color for your annotation along with changing any other features of interest; I will use a red painbrush, so I click on the color chooser and pick a red color.  Then you simply start painting in the preview window:

Now go back to the editing window, and adjust the length of the Adjustment Clip as needed for your video.  You can add as many additional annotations as needed using this same method.  

Occasionally I realize that I have said something incorrect in the video. Rather than re-recording or trying to edit the video itself, I simply add a title to the screen nothing that I misspoke. This is easy using the Title feature from the Effects library in the editing page:

Once you are done, simply export the video using the QuickExport feature and you are ready to go!

Thursday, November 26, 2020

A quick and dirty workflow for creating lecture videos

I'm currently in the midst of fully reworking my undergraduate statistics course for online learning, which includes creating about 40 short (5-10 minute) mini-lectures for the students to view asynchronously.  As much as I would love to put many hours into generating high-touch videos, my time is limited so I needed a workflow that would allow me to generate these videos with as little overhead as possible.  Here is what I came up with.

Platform: I'm using a Macbook Pro as part of the setup described in my previous post on my home office setup.   

Software: I use Keynote to create the slides, Zoom to record the presentation, and QuickTime Player for cleaning up the video.

Slide Prep:  First, it's important to make sure that your slides don't use any builds, because (at least for Keynote) the Zoom "Slides as virtual background" feature doesn't support builds.  So just separate your builds out into separate slides.  Second, because your head will appear in the bottom right of the screen, you should make sure that there is no essential material that appears in that location.  In the worst case, you can always just move your head out of the way, which I imagine is someone amusing for the viewer.

Recording workflow:

1. Start a Zoom meeting, and start Screen Sharing. Under the Advanced tab, choose "Slides as virtual background", share the screen and the choose your presentation file.  

The slides will load, with a small image of your head in the bottom right.  

One exception to this workflow is if you need to present video as part of your presentation, which doesn't work with the "Slides as virtual background" option. In this case you'll need to use a regular screen share, which will lose the talking head in the corner.

2. Start recording, being sure to select "Record on this computer".

3. After you start recording, give yourself a few seconds to settle and get any fidgets out of the way.  Then start talking.  I try to give the entire lecture without stopping, realizing that I will probably make a few mistakes, and that's ok.  Occasionally I find myself totally flummoxed part way through, or realizing that I need to make a big change, in which case I simply quit and start over.  Since each of the videos is relatively short, I don't lose that much time if I have to bail partway through.

One tip that I still find somewhat difficult to follow: Try to finish your comments about a particular slide before you flip to the next slide.  I find that I have a habit of flipping forward to the next slide as I am finishing my comments about a slide.  This is usually fine for talk, but for these lectures I am using Panopto within Canvas to embed quiz questions in the video, which I usually want to place at a transition between slides. However, if I am still talking about the previous slide after I have transitioned to the next slide, the quiz placement becomes awkward.

4. When you get to the end of the lecture, give yourself a few seconds of stillness on the last slide or on a blank slide inserted after the last slide.

5. End the Zoom session using the End button (no need to stop sharing).  This will cause Zoom to save the video to a file, which will pop up in the Finder once it's done. 

Post-processing workflow:

1.  Open the mp4 file from the Zoom recording folder in QuickTime Player. 

2. Find the point where you want to start the video, just before you start talking.  With the player paused at that location, choose "Split Clip" from the Edit menu. Click on the leftmost section in the timeline, and press Delete to remove that leading section, then click Done to save the change.  Now do the same for the end of the video, finding the point where you want to end and removing the trailing section.

There is a "Trim clip" feature that one can use to do this in a single step rather than two,  but I find that it's easier to be precise about where the trimming happens using the Split Clip method.

3. Close and save the video to a new .mp4 file.

I find that this method takes me only a minute or so to post-process each video once it's recorded.  Of course, you could do much fancier stuff if you wanted; in that case I would check out DaVinci Resolve, which is one of the most amazing pieces of free software ever created but has a pretty steep learning curve for serious video editing

Uploading the video:

If you are using Canvas and your instance supports Panopto, then I would recommend using that method to upload the videos, since it provides viewing statistics (e.g. for recording which students have watched the video) and also allows embedding quiz questions within the video.  

As always, suggestions are welcome in the comments below!