Aim to make RTC easy.
Only support python 3.11.9 now.
A rtc library supporting janus & p2p, more program languages (python, C#, C++ now) in the future.
python3 setup.py sdist build
pip3 install ./dist/aolesrtc-xxx.tar.gz
pip3 install aolesrtc
export LD_LIBRARY_PATH=/path/to/aolesrtc/lib/linux/x86_64/lib
brew install python@3.10
#video
ffmpeg -i source.mp4 \
-f rawvideo -pix_fmt yuv420p -s 1080x1920 -r 25 \
-t 20 -y ./examples/video_1080x1920_25fps.yuv
#audio
ffmpeg -i source.mp4 \
-f s16le -ac 1 -ar 24000 \
-t 20 -y ./examples/video_24000.pcm
- Deploy the server with docker
sudo docker load docker_aserver_202310202340.tar
sudo docker run -d -i --net=host --name=aserver --platform=linux/amd64 --restart=always laoleshisui/aserver:202310202340 /home/aserver/bin/aserver -f /home/aserver/defaults.yaml
- Config your own server ip in defaults.yaml
See examples/p2pprocessor.py for more details
- Create a sender to send video frame and audio sample. If the receiver's id is known, you can just connect it with the id.
def CreateSender():
Controller.LoadConfigFile("./defaults.yaml")
Controller.InitLog("./p2p_sender.log")
time.sleep(3) # wait for receiver logined
peer_data_1 = CreatePeer(is_sender=True, is_receiver=False)
time.sleep(1)
# assume the last id is of the sender
receiver_id = last_id - 1
print("ConnectToPeer (receiver_id = last_id - 1):", receiver_id)
peer_data_1["p2p_client"].ConnectToPeer(receiver_id)
send_yuv_thread = threading.Thread(target=send_yuv, args=(peer_data_1, "/path/to/video_1080x1920_25fps.yuv",))
send_yuv_thread.start()
send_pcm_thread = threading.Thread(target=send_pcm, args=(peer_data_1, "/path/to/video_24000_s16le.pcm",))
send_pcm_thread.start()
send_yuv_thread.join()
send_pcm_thread.join()
- Create a receiver to receive video frame and audio sample, you can get the data in the callback and also play audio automatically if not callback
def CreateReceiver():
Controller.LoadConfigFile("./defaults.yaml")
Controller.InitLog("./p2p_receiver.log")
peer_data_2 = CreatePeer(is_sender=False, is_receiver=True)
render(peer_data_2["video_sink"])
See examples/videoroom.py and examples/audiobridge.py for details
QQ Group: 947652097