This project is a simple video chat tool.
It supports IPv4 and IPv6, using TCP protocal temporarily. Not finished yet , next step is to change into UDP. The current stable version isv0.2
, the current developing version isv0.4
. If you have thoughts for any of them, please e-mail me or just open your PR, I am very glad to learn from your brilliant idea.
注:授权实验楼发表的教程对应版本为 v0.2, 该部分代码在 v0.2/Linux 下。
v0.4
will provide the following abilities.
v0.3
. However, v0.4
will reconstruct the classes (both server and client), the new version will use less bandwidth and memory.v0.4
. The server
will be reconstructed using Golang 1.7.3
in v0.4
, which can improve a lot in performance.The script is written in python 3.5, using some packages, all listed below.
openCV
from its official site. Also, install by pip pip install opencv-python
is needed. Then, install ffmpeg
. Download it from here, I suggest you chose the binary file and just install it simply. After you install cv2
, numpy
and matplotlib
will also be installed.pip3 install pyaudio
.sys
, struct
, pickle
, time
, threading
, argparse
, zlib
, and socket
.OpenCV
with Python support in Linux is a little troublesome. You can download opencv.sh to install it easily, or follow these steps.$ mkdir ichat && cd ichat
$ sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff5-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev
$ wget https://github.com/Itseez/opencv/archive/2.4.13.zip
$ unzip 2.4.13.zip
$ cd 2.4.13
$ mkdir release && cd release
$ cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..
$ sudo make
$ sudo make install
$ sudo nano /etc/ld.so.conf.d/opencv.conf
$ Input /usr/local/lib and save
$ sudo ldconfig -v
$ sudo nano /etc/bash.bashrc
$ --Add the following two lines in the end of bash.bashrc
$ PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
$ cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
PYTHON3_EXECUTABLE=/usr/bin/python3 \
PYTHON_INCLUDE_DIR=/usr/include/python3.4 \
PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.4m.so \
PYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.4/dist-packages/numpy/core/include ..
Run python3 main.py <parameters>
. Also, you can download the executable binary file ichat.exe
from my cloud storage: here. Press Esc
or Ctrl-C
to stop this tool. The parameters are:
127.0.0.1
.x
, another port will be x+1
.--version=6
.--noself=True
. Do not set any value to this flag if you need to observe your image.Remote
, press Esc
to quit, in You
, press Esc
to close the window of yourself, but chat remains.ichat.exe
, you will see yourself.v0.3
provides a file server.py
, which is used to transmit data between IPv4 and IPv6. There are 4 instances created in running, the parameters are in format below. The first two parameters are the two ports used to receive connections from clients, and the next two parameters points the protocal they use. The last parameter shows the direction, True
means client2 receives data from client1, False
reverse it. contact1to2v = Remote_Server(start_port, start_port+5, 6, 4, True)
contact2to1v = Remote_Server(start_port+1, start_port+4, 6, 4, False)
contact1to2a = Remote_Server(start_port+2, start_port+7, 6, 4, True)
contact2to1a = Remote_Server(start_port+3, start_port+6, 6, 4, False)
start_port
is 10000, then the server will listen 8 ports (10000
to 10007
), the first 4 ports will connect with remote client A's audio server/client and video server/client, and the next 4 ports will connect with another remote client B.v0.4
, I will reconstruct the models and use less ports. The current performance is not good, since many parameters are not adjusted. The next version v0.4
will fix most of the problems.v0.3
, even two clients are in different LAN, they can still contact. However, the quality depends on the bandwidth of server. I want to find a way to let server make the two clients connect directly, however I have no idea until now.In server, run python2 server.py
to start server, remember to check the 4 instances. In client, run python3 main.py [OPTIONS]
to start client. Press Esc
to stop the client. The new version can assign the following options.
127.0.0.1
.start_port
in server code.--version=6
.--noself=True
. Do not set any value to this flag if you need to observe your image.v0.1
.v0.2
.v0.2
.v0.3
, supply a protocal-crossed version, two hosts using IPv4 and IPv6 can contact in this version.v0.3
, which is an unstable version, it will be improved a lot in v0.4
.All codes in this repository are licensed under the terms you may find in the file named "LICENSE" in this directory.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。