Screen and Audio Capture with ffmpeg on Windows 7

I’ve recently needed to capture a video stream that was being stream in some obscure format, so direct screen and audio recording was the only (at least easiest) option. It works fine with freely available software, but you’ll need some patience and a decent machine.

Follow the installation instructions on https://github.com/rdp/screen-capture-recorder-to-video-windows-free to install a free capture device.

Get ffmpeg for Windows from this site.

On the ffmpeg command prompt (ff-prompt.bat inside the unzipped ffmpeg folder) execute this

ffmpeg -rtbufsize 100000k -r 65535/2733 -f dshow -i audio="virtual-audio-capturer":video="screen-capture-recorder"  c:\output.mp4

These values aren’t entirely out of the blue, but the result of some experimentation and googling:

  • If the encoding performance can’t keep up, frames will be dropped. This ruins the audio in the mp4 format. In this case, you might use avi which handles this better, but the file size is much bigger with the avi format
  • If encoding performance can’t keep up, you might want to either reduce your screen resolution for the capture (if you’re trying to capture a video stream, it’s most often not full HD anyway) or limit the recording to a portion of your screen by specifying this parameter before the output file: -vf crop=640:480:0:0
  • The rtbufsize (real time buffer size) parameter is necessary on my machine to stop ffmpeg dropping frames even though the encoding speed is high enough
  • The r (framerate, set to 24 here) parameter is necessary to set the frame rate to a fixed value, this avoids some strange errors when encoding to avi
  • There’s many more parameters left to tweak for quality/performance

To list the available audio devices, use

ffmpeg -list_devices true -f dshow -i dummy
This entry was posted in Computer. Bookmark the permalink.

One Response to Screen and Audio Capture with ffmpeg on Windows 7

Leave a Reply

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

Please solve this little equation for verifying that you\'re human *