Record screen + audio with FFMpeg

$480 for Camstasia? I think not. CamStudio? Buggy as hell. Luckily, we have an excellent FREE cross-platform tool that let’s us easily create a video-recording of your desktop including audio: FFMpeg.

If you are running Windows, download the x64 here.

Extract the downloaded archive and open a command prompt in the bin folder.

To check your version:
ffmpeg --version

ffmpeg version N-79630-g9ac154d Copyright (c) 2000-2016 the FFmpeg developers

To show available input devices for audio:
ffmpeg -list_devices true -f dshow -i dummy

DirectShow audio devices
“Microphone (5- Webcam C170)”

This is the magic string you’ll need to specify in the next, awesome command.

ffmpeg -y -f dshow -i audio="Microphone (5- Webcam C170)" -f gdigrab -video_size 1920x1080 -i desktop -vcodec h264 my-screen-with-audio.mkv

This will record your screen at full-hd encoded using h264 and including audio sourced from your microphone. When you want to stop the recording, press Ctrl+C in command prompt and your video file will be ready, too easy!

If you want to record the screen only (no audio), use:
ffmpeg -f gdigrab -offset_x 0 -offset_y 0 -video_size 1920x1080 -i desktop -vcodec h264 my-screen-only.mkv

Thank you FFMpeg developers!

Play video at specific position and size

Using VLC, we can have a video begin playback at a specific screen location and window size. I found this useful when creating a screen recording of some software where I wanted to have a video overlay playing in the corner of the screen at the same time. Here’s the command line I used (for VLC 2.0.8 on Windows 8.1):

vlc.exe –no-video-deco –no-embedded-video –video-x=1320 –video-y=700 –width=600 –video-on-top –qt-system-tray –qt-start-minimized my-video.mp4 vlc://quit

  • The vlc://quit is a special playlist entry that causes VLC to quit after playback of the preceeding video.
  • Adjust video-x and video-y to set screen position, and set width or height to set window size.
  • The no-video-deco and video-on-top will remove the window chrome, and ensure the video is always on top.