Important Bits

Recording & compressing short screencasts on Windows

September 28, 2015

Tools I use

  • CamStudio with the lossless codec for screen recording
  • ffmpeg
  • a scripting environment with shell access (I chose node.js) for batch converting

My process

  1. Capture video using Camstudio

    I choose to record 1 window as my region, and compress with the Camstudio lossless codec.

  2. Use ffmpeg via a node.js script to batch convert videos

    This turns them into something that can be played in a web browser

    var fs = require('fs'),
     util = require('util'),
     child_process = require('child_process')
    var shellCommand =
     'c:\\ffmpeg\\bin\\ffmpeg.exe -i %s -codec:v libx264 -profile:v high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -threads 0 -y %s'
    fs.readdir('./', function(err, paths) {
     paths.forEach(function(path) {
       // TODO - only convert *.avi files
       var command = util.format(
         path.replace('.avi', '.mp4')
       var child = child_process.exec(command, function(error, stdout, stderr) {
         console.log(path, err, stdout, stderr)

    I base my settings on Jemej’s ffmpeg tutorial. The quality and framerate are low since I usually record things that don’t move much like terminal windows.

Ideas for improving

  • this is dumb – it runs every .avi file in the folder through ffmpeg whether it needs or not.
  • are there smarter ways to use all the cores of my CPU?
  • what about watching for .avi file changes/additions with gaze and encoding new .avi files as soon as CamStudio saves them?

Adam Sullovey

Written by Adam Sullovey, powered by Gatsby.
Find me on codepen, github, or at Toronto meetups.

tags: ffmpeg, nodejs