Skip to main content

x2webrtc

PyPI PyPI Supported Python Versions GitHub license

x2webrtc is a command-line tool for forwarding an X window as a media track through WebRTC. It is a simple tool; it just grabs screenshots for the window with Xlib and send them via a WebRTC stream, but it can realize the following features:

  • You can send an X window through the NAT.
  • A media stream is transported using a secure method. (compared to the standard VNC)
  • You can easily install it by pip.
  • You don't necessarily have admin access to the system.

Install

Note that Python 3.6+ and X Window System are required to use the tool.

pip install x2webrtc

The tool requires aiortc to work with WebRTC. Please refer to the install instruction of aiortc if you failed to install it automatically.

Quickstart

NOTE: Currently, hand signaling is required to start a WebRTC session. I am planning to implement a plug-in system so that a user can customize its signaling method.

  1. Start x2webrtc.

    x2webrtc forward
    

    If DISPLAY environment is not set to your environment, pass --display argument to specify an X server.

    x2webrtc forward --display :0
    
  2. (tentative) Copy a WebRTC offer. You will see the following message on your terminal:

    -- Please send this message to the remote party --
    {"sdp": "..." , "type": "offer"}
    

    Please copy the offer json.

  3. (tentative) Open the web viewer and click Connect button.

  4. (tentative) Paste the offer json into Input Offer text-area (A) and click Create Answer button (B). Then you will get an answer json (C). Copy the json again.

  5. (tentative) Go back to your terminal. Paste the answer json into the terminal, then press Enter.

  6. Now you will see your screen in the web viewer.

Usage

usage: x2webrtc [-h] [-v] COMMANDS ...

Commands:
    forward       forward X Window
    info          show window information of the X server

optional arguments:
  -h, --help      show this help message and exit
  -v, --verbose   verbose; can be used up to 3 times to increase verbosity

x2webrtc forward

Forward a specified X window.

usage: x2webrtc forward [-h] [--display DISPLAY]

optional arguments:
  -h, --help         show this help message and exit
  --display DISPLAY  display_name of the X server to connect to (e.g., hostname:1, :1.)

x2webrtc info

Show information on a specified X server.

usage: x2webrtc info [-h] [--display DISPLAY] [--props]

optional arguments:
  -h, --help         show this help message and exit
  --display DISPLAY  display_name of the X server to connect to (e.g., hostname:1, :1.)
  --props            show all properties of each window

FAQ

Failed to install PyAV

PyAV uses AV_CODEC_CAP_HARDWARE macro in its source code, but it seems to be available in libavcodec >= 58.0. Check the version of libavcodec and try again.

Metadata

Release files for x2webrtc 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for x2webrtc 0.1.0
File Interpreter ABI Platform
x2webrtc-0.1.0-py3-none-any.whl Python 3 none any Details

Release files / x2webrtc-0.1.0-py3-none-any.whl

Download URL x2webrtc-0.1.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbfa6462b2271f9369d0efa00e7ba9d1cdb93f95a5056c71f88698e307f21d04
BLAKE2b-256 checksum
How to use checksums
e4a8b59ea7dbef4ef7be573a6200aebdb1a6d0c533f87c0448c5a4e44e41ef19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

Release history Release notifications | RSS feed

0.2.0

1 release file

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page