Documentation for C-Werk 2.0.

Previous page Receiving video from the application window on the Server with the FFmpeg driver  Receiving video from the Server monitor with the FFmpeg driver Next page

Your Server can receive video along with system audio and microphone audio from remote Client screens via the FFmpeg driver using the RTSP translation. To do it, do the following:

  1. On the Server:
    1. Open the port for receiving data from the remote Client.

      Note

      The open port mustn’t be occupied. You can use the following command to check if the port is available: 

      netstat -ano | findstr :<Port>

      It is recommended to set ports higher than 10000.

    2. Add a 1 channel device and specify its address in the IP address field in the following format.

      listenrtsp://<Server IP address>:<Port>

      Note

      The RTSP link is specified optionally.

      listenrtsp://<Server IP address>:<Port>/<RTSP link>

      For example:

      listenrtsp://127.0.0.1:1554/live1.sdp

      where
      127.0.0.1IP address of the Server;
      1554RTSP port, which mustn’t be occupied. To check if the port is available, you can use the command from step 1a;
      live1.sdpRTSP link.

  2. On the remote Client:
    1. Download the package of open source FFmpeg libraries from the official website.
    2. Open the command prompt, and go to the folder containing the ffmpeg.exe file.
    3. Run the following command:

      ffmpeg.exe -f gdigrab -video_size 640x480 -i desktop -c:v <Codec> -f rtsp -muxdelay 0.1 "listenrtsp://<Server IP address>:<Port>/<RTSP link>"

      where 
      the Codec parameter may accept the mpeg2video, mpeg4, h264 or hevc value;
      – the video_size 640x480 and -muxdelay 0.1 parameters may be omitted or altered.
      If necessary, you can specify additional parameters in this command. 

      Supported parameters

      Description

      -draw_mouse <int>

      Mouse cursor presence. Available range: 0 to 1, default value is 1

      -show_region <int>

      Capture area indication. Available range: 0 to 1, default value is1

      -framerate <video_rate>

      FPS value (number of frames)

      -video_size <image_size>

      Video image size (pixels)

      -muxdelay <int>Maximum demultiplexer-decoding delay (seconds)
      -offset_x <int>

      Capture area X offset (pixels). Default value is 0

      -offset_y <int>

      Capture area Y offset (pixels). Default value is 0

      After the command execution, remote Client's screen is shared on your display.

      Note

      • The axes of the capture area are offset from the upper left corner of the main monitor.
      • If the additional monitor is located to the left of the main monitor, a negative value of offset_x must be used to move the capture area to the additional monitor.
      • If the additional monitor is located above the main monitor, a negative value of offset_y must be used to move the capture area to the additional monitor.


Examples of commands to share the screen of the remote Client

On the remote Client, you can run the commands to share the screen.

  • If there are multiple screens on the remote Client, in order to share them all, you must run the command:

    ffmpeg.exe -f gdigrab -i desktop -c:v <Codec> -f rtsp -muxdelay 0.1 "listenrtsp://<Server IP address>:<Port>/<RTSP link>"

    where
    the -video_size parameter is missing, thus the entire video space is used.

  • If there are several screens on the remote Client, they can be shared separately.

    For example, to share only the first screen, you can run the command:

    ffmpeg.exe -f gdigrab -offset_x 0 -offset_y 0 -video_size 1920x1080 -i desktop -c:v <Codec> -f rtsp -muxdelay 0.1 "listenrtsp://<Server IP address>:<Port>/<RTSP link>"

    Additionally, you can specify the -pix_fmt parameter to select the color scheme, since some video codecs may not work correctly:

    -pix_fmt yuv420p

    To share only the second screen, you can run the command:

    ffmpeg.exe -f gdigrab -offset_x 1920 -offset_y 0 -video_size 1920x1080 -i desktop -c:v <Codec> -f rtsp -muxdelay 0.1 "listenrtsp://<Server IP address>:<Port>/<RTSP link>"

    where
    the -offset_x 1920 parameter offsets the X axis to the right by 1920 pixels, thus skipping the first screen and using the second screen.
    If you want to share the third screen of the remote Client, the value of the -offset_x parameter is -offset_x 3840, i.e. the X axis is offset to the right by 3840 pixels, thus skipping the first and second screens and using the third screen.

    Note

    The value of the -offset_x parameter depends on the screen resolution. If the screen resolutions are different, the resolution of the individual screen must be taken into account to share it.

  • It is possible to combine sharing from several specified screens.

    For example, you can run the command to share the first and second screen:
    ffmpeg.exe -f gdigrab -offset_x 0 -offset_y 0 -video_size 3840x1080 -i desktop -c:v <Codec> -f rtsp -muxdelay 0.1 "listenrtsp://<Server IP address>:<Port>/<RTSP link>"

    where
    the value of the -video_size 3840x1080 parameter is the sum of the widths of the first and second screens.
    To share the second and third screens, you can run the command:

    ffmpeg.exe -f gdigrab -offset_x 1920 -offset_y 0 -video_size 3840x1080 -i desktop -c:v <Codec> -f rtsp -muxdelay 0.1 "listenrtsp://<Server IP address>:<Port>/<RTSP link>"

    where
    the -offset_x 1920 parameter offsets the X axis by the width of the first screen;|
    the value of the -video_size 3840x1080 parameter is the sum of the widths of the second and third screens.


  • When using three or more screens on the remote Client, you can decode NVIDIA format into FFmpeg.
    To do this, run the following command:
    ffmpeg.exe -f gdigrab -i desktop -c:v <Codec> -f rtsp -muxdelay 0.1 "listenrtsp://<Server IP address>:<Port>/<RTSP link>"
    where
    the Codec parameter can accept the h264_nvenc (H264), hevc_nvenc (H265) values.

    Note

    For Intel graphics cards, you must use the h264_qsv and hevc_qsv codecs, and for AMD cardsh264_amf and hevc_amf.

    The maximum screen resolution that NVENC h.264 can work with is 4096x4096 pixels. The maximum screen resolution that NVENC h.265 can work with is 8192x8192 pixels. For example, when using NVENC h.264, three screens with a resolution of 1920x1080 pixels won’t work.
  • No labels