This project is a simple video chat tool.
It supports IPv4 and IPv6, using TCP protocaland not supports audiotemporarily. Not finished yet , next step is toadd audio andchange into UDP. The current stable version isv0.2
, the current developing version isv0.3
.
注:授权实验楼发表的教程对应版本为 v0.2, 该部分代码在 v0.2/Linux 下。
v0.3
will provide the following functions.
- Two hosts using different IP protocals can contact by a server, which will be provided in
v0.3
. - Everywhere, not only lan, can have an ichat using
v0.3
. - One of the typical using: Your host is in a college lan, using IPv6; another host is in the wide Internet, like home or hotel, using IPv4. The two hosts can build a contact in
v0.3
.
The script is written in python 3.5, using some packages, all listed below.
- cv2 : cv2 is the openCV packages for python. You can download
openCV
from its official site. Also, install by pippip install opencv-python
is needed. Then, installffmpeg
. Download it from here, I suggest you chose the binary file and just install it simply. After you installcv2
,numpy
andmatplotlib
will also be installed. - pyaudio : packages for dealing with audio. You can install it by
pip3 install pyaudio
. - Built-in packages:
sys
,struct
,pickle
,time
,threading
,argparse
,zlib
, andsocket
.
To install 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
Attention, if you use Python3, you may need to specify the path. Add some options below.
$ 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 ..
Just 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:
- --host: the remote host address you want to connect. Support IPv4 and IPv6. Default is
127.0.0.1
. - --port: the port you want to use. The remote should use the same port as yours. Default is 10087. The tool use 2 ports, and if you set port to be
x
, another port will bex+1
. - --version or -v: the IP version you want to use. Default is 4, if you want to use IPv6, remember setting
--version=6
. - --level: the image level you want. It could be 0, 1, 2, 3. Values bigger than 3 is same to 3. Level 0 is the best quality, that means you will see the original image of the remote camera. However, it requires high network condition. Default is 1. If your network is blocked, please use level 2 or 3.
- --noself: The tool will display both the remote and your videos in default. If you do not need to show yourself on your screen, use
--noself=True
. Do not set any value to this flag if you need to observe your image. - In
Remote
, pressEsc
to quit, inYou
, pressEsc
to close the window of yourself, but chat remains. - One screenshot for usage is below. I had an ichat with myself. If you double click
ichat.exe
, you will see yourself.
- 2016-9-23: Add this project, video is ok. Define
v0.1
. - 2016-9-24: Add audio transmission, add quality settings, defile
v0.2
. - 2016-10-6: Build repository.
- 2016-10-9: Add Linux version for
v0.2
. - 2016-10-13: Add authorisation.
- 2016-11-2: Start updating v0.3, supply a protocal-crossed version, two hosts using IPv4 and IPv6 can contact in this version.
All codes in this repository are licensed under the terms you may find in the file named "LICENSE" in this directory.