Skip to content

Instantly share code, notes, and snippets.

@nicolsc
Created February 23, 2023 15:28
Show Gist options
  • Save nicolsc/1190cbd5ac13018bb6bb29ea9e1e0fa3 to your computer and use it in GitHub Desktop.
Save nicolsc/1190cbd5ac13018bb6bb29ea9e1e0fa3 to your computer and use it in GitHub Desktop.
Video + Screen recording combined

Recording simultaneously Screen + Camera

Set-up

  • macOS (tested with macOS Monterey 12.3)
  • QuickTime Player (tested with 10.5)
  • ffmpeg (tested with 5.1.1)

Recording

Run 2 recordings in parallel.

In Quicktime

  • Quicktime > File > New Video Recording
  • Quicktime > File > New Screen Recording
  • Stop both when over
  • Save the 2 files as .mov files

Stitching together

ffmpeg command

ffmpeg -i file1.mov -i file2.mov -filter_complex "[0]scale=iw/4:ih/4 [pip]; [1][pip] overlay=main_w-overlay_w-10:10" -profile:v main -level 3.1 -vcodec h264 -acodec mp3 output.mp4

params

Sound track

Only the camera recording should come with a sound track.

Picture in Picture & Scale

-filter_complex "[0]scale=iw/4:ih/4 [pip]; [1][pip] overlay=main_w-overlay_w-10:10" -profile:v main -level 3.1 -vcodec h264 -acodec mp3 output.mp4

Says that file #0 (first arg) should be used as pip, at 25% its original size

PiP is positioned in the top right, as is defined by overlay=main_w-overlay_w-10:10 Alternatives:

  • Bottom left : overlay=main_w-overlay_w-10-10:main_h-overlay_h-10
  • Top left: overlay=10:10
  • Bottom right:overlay=main_w-overlay_w-10-10:main_h-overlay_h-10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment