1.3.13. Video Inputs

Outgoing video feed types provided by the SDK (MediaServerOutgoingVideoFeed, PeerLocalVideoFeed) accept video input from a variety of sources:

providing the ability to capture and transmit video from, respectively:

  • a V4L2 device (e.g. a webcam)

  • an X11 desktop or window

  • a test pattern generator

For example, to transmit a webcam to a media server:

    PxMedia::VideoInputFeedV4Linux2 inputVideo;
    inputVideo.deviceProperties().device("/dev/video0");
    inputVideo.videoCapabilities().frameRate(30).mediaType(
        PxMedia::VideoCapabilities::MediaType::IMAGE_JPEG);
    auto outgoingFeed =
        PxMedia::MediaServerOutgoingVideoFeed::create(
            mediaSession, props, inputVideo, localOut);

To transmit a screen or window capture to a peer:

    PxMedia::VideoInputFeedXImage inputVideo;
    inputVideo.videoCapabilities().frameRate(30);
    PxUtility::Rectangle<int> captureArea;
    captureArea.right(1279).bottom(719);
    inputVideo.captureArea(captureArea);
    auto outgoingFeed = PxMedia::PeerLocalVideoFeed::create(
        peerSession, feedProperties, inputVideo, localOut, &encoderProperties);

To transmit a test video stream to a media server:

    PxMedia::VideoInputFeedTestPattern inputVideo;
    inputVideo.videoCapabilities().frameRate(30).width(1280).height(720);
    auto outgoingFeed =
        PxMedia::MediaServerOutgoingVideoFeed::create(
            mediaSession, props, inputVideo, localOut);