Skip to content

Multi monitor Capture

Lakshya Kapoor edited this page Apr 24, 2019 · 3 revisions

This topic will help you capture a specific monitor in a multi-monitor setup.

If you have two screens running at 1920x1080, the total resolution is 3840x1080. In this case, you can record the second screen from pixel 1921 to 3840.

Microsoft Windows (gdigrab)

advanced: { offset_x: 1921, offset_y: 0, video_size: '1920x1080' }
ScreenRecorder::Desktop.new(output: 'recording.mkv', advanced: advanced)

Linux (x11grab)

advanced:  { video_size: '1920x1080' }
ScreenRecorder::Desktop.new(input: ':0.0+1920,0', output: 'recording.mkv', advanced: advanced)

Replace :0.0 with your display number if applicable.

macOS (avfoundation)

Retrieve the list of available input devices and pass in the display number as input. For example, if your device list looks like this:

$ ffmpeg -f avfoundation -list_devices true -i ""
AVFoundation input device @ 0x7fc74141a0c0] AVFoundation video devices:
[AVFoundation input device @ 0x7fc74141a0c0] [0] HD-camera FaceTime (integrated)
[AVFoundation input device @ 0x7fc74141a0c0] [1] Capture screen 0
[AVFoundation input device @ 0x7fc74141a0c0] [2] Capture screen 1
[AVFoundation input device @ 0x7fc74141a0c0] AVFoundation audio devices:
[AVFoundation input device @ 0x7fc74141a0c0] [0] Built-in Input
[AVFoundation input device @ 0x7fc74141a0c0] [1] Boom2Device

Pass in input: 2 ([2] Capture screen 1) to record the second screen.