chrome.tabCapture.capture produces letterboxed videos

246 views
Skip to first unread message

Darin Dimitrov

unread,
Mar 16, 2022, 12:32:08 PM3/16/22
to Chromium Extensions
I use chrome.tabCapture.capture to capture the contents of chrome tab:

const constraints = {
    audio: false,
    video: true,
    videoConstraints: {
        mandatory: {
            chromeMediaSource: "tab",
            minFrameRate: 4,
            maxFrameRate: 30,
            maxWidth: 3840,
            maxHeight: 2160
        }
    }
};

chrome.tabCapture.capture(constraints, stream => {

});


Depending on the client screen resolution, the video has black bars on top and bottom (letterboxed).

I was wondering if there is a way to reliably calculate the height of those bars.

For example, for 2560x1234 window size (window.innerWidth, window.innerHeight), I get 182px bands on top and bottom in the resulting video and was wondering how is this height obtained.

Stefan vd

unread,
Mar 17, 2022, 8:49:49 AM3/17/22
to Chromium Extensions, darin.d...@progress.com
Hi there,

I see you did not add the "minWidth" and "minHeight" in your chrome.tabCapture.capture code line.
Have you tried adding both of those items, which are the same size as the width and height of your window?

Thanks,
Stefan vd

Darin Dimitrov

unread,
Mar 18, 2022, 9:50:01 AM3/18/22
to Chromium Extensions, Stefan vd

Hi, thanks for the tip. 

Setting minWidth and minHeight to the size of my window removes the black bars!

Stefan vd

unread,
Mar 18, 2022, 10:13:28 AM3/18/22
to Chromium Extensions, darin.d...@progress.com, Stefan vd
Hi there,

You are welcome!

Thanks,
Stefan vd

Reply all
Reply to author
Forward
0 new messages