# Set video layout (/en/realtime-media/on-premise-recording/build/customize-the-recording/layout/linux-cpp)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

This guide shows you how to configure the video layout during composite recording using the On-Premise Recording SDK.

    ## Understand the tech [#understand-the-tech]

    In composite recording mode, the SDK renders the final video on a canvas that includes multiple user video streams. Each stream is placed in a defined region of the canvas. The canvas acts as the background, and you specify the dimensions and position of each user’s video.

    ![Composite recording canvas with user video regions](https://assets-docs.agora.io/images/on-premise-recording/user-region-canvas-diagram.png)

    <CalloutContainer type="info">
      <CalloutDescription>
        The aspect ratio of a user's video must match that of the assigned region. If the aspect ratios differ, the SDK crops the video, which can result in image loss.
      </CalloutDescription>
    </CalloutContainer>

    ## Prerequisites [#prerequisites]

    Before using layouts, complete the steps in the [Quickstart](/en/realtime-media/on-premise-recording/quickstart) guide to integrate the SDK and set up basic recording.

    ## Implementation [#implementation]

    To configure the layout, call the `setVideoMixingLayout` method and pass a `VideoMixingLayout` object that defines:

    * Canvas dimensions and frame rate
    * Background color or image
    * Layouts for each user's video

    ```cpp
    struct VideoMixingLayout recorderLayout;
    recorderLayout.canvasWidth = 1280;
    recorderLayout.canvasHeight = 720;
    recorderLayout.canvasFps = 25;

    UserMixerLayout layout[2];
    layout[0].userId = "1234";
    layout[0].config.x = 0;
    layout[0].config.y = 0;
    layout[0].config.width = 640;
    layout[0].config.height = 360;

    layout[1].userId = "5678";
    layout[1].config.x = 720;
    layout[1].config.y = 270;
    layout[1].config.width = 540;
    layout[1].config.height = 320;

    recorderLayout.userLayoutConfigNum = 2;
    recorderLayout.userLayoutConfigs = layout;
    recorder->setVideoMixingLayout(recorderLayout);
    ```

    The sample code creates the following composite layout:

    ![Composite layout](https://assets-docs.agora.io/images/on-premise-recording/composite-layout.svg)

    ## API reference [#api-reference]

    * [`setVideoMixingLayout`](/en/api-reference/api-ref/on-premise-recording#setvideomixinglayout)
    * [`VideoMixingLayout`](/en/api-reference/api-ref/on-premise-recording#videomixinglayout)

    
  
      
  
