livetalking/README.md

101 lines
3.8 KiB
Markdown
Raw Normal View History

2024-06-02 22:25:19 +08:00
Real time interactive streaming digital human realize audio video synchronous dialogue. It can basically achieve commercial effects.
实时交互流式数字人,实现音视频同步对话。基本可以达到商用效果
2023-12-19 09:41:52 +08:00
2024-06-17 08:21:03 +08:00
[ernerf效果](https://www.bilibili.com/video/BV1PM4m1y7Q2/) [musetalk效果](https://www.bilibili.com/video/BV1gm421N7vQ/) [wav2lip效果](https://www.bilibili.com/video/BV1Bw4m1e74P/)
2023-12-19 09:41:52 +08:00
2024-10-05 17:25:01 +08:00
## 为避免与3d数字人混淆原项目metahuman-stream改名为livetalking原有链接地址继续可用
2024-03-31 12:01:28 +08:00
## Features
2024-06-17 08:21:03 +08:00
1. 支持多种数字人模型: ernerf、musetalk、wav2lip
2024-05-26 18:07:22 +08:00
2. 支持声音克隆
3. 支持数字人说话被打断
2024-03-31 12:01:28 +08:00
4. 支持全身视频拼接
2024-04-21 18:19:24 +08:00
5. 支持rtmp和webrtc
2024-05-04 10:10:41 +08:00
6. 支持视频编排:不说话时播放自定义视频
2024-03-31 12:01:28 +08:00
2024-01-13 20:12:08 +08:00
## 1. Installation
2023-12-19 09:41:52 +08:00
2024-01-13 20:12:08 +08:00
Tested on Ubuntu 20.04, Python3.10, Pytorch 1.12 and CUDA 11.3
2023-12-19 09:41:52 +08:00
2024-01-13 20:12:08 +08:00
### 1.1 Install dependency
2023-12-19 09:41:52 +08:00
2023-12-28 13:11:18 +08:00
```bash
2024-01-06 21:17:34 +08:00
conda create -n nerfstream python=3.10
conda activate nerfstream
2024-05-19 18:32:40 +08:00
conda install pytorch==1.12.1 torchvision==0.13.1 cudatoolkit=11.3 -c pytorch
2023-12-19 09:41:52 +08:00
pip install -r requirements.txt
2024-09-08 22:53:37 +08:00
#如果不训练ernerf模型不需要安装下面的库
2023-12-19 09:41:52 +08:00
pip install "git+https://github.com/facebookresearch/pytorch3d.git"
2023-12-28 13:11:18 +08:00
pip install tensorflow-gpu==2.8.0
2024-05-19 18:32:40 +08:00
pip install --upgrade "protobuf<=3.20.1"
2023-12-19 09:41:52 +08:00
```
2024-08-23 23:19:38 +08:00
如果用pytorch2.1torchvision用0.16可以去torchvision官网根据pytorch版本找匹配的,cudatoolkit可以不用装
2024-05-19 18:32:40 +08:00
安装常见问题[FAQ](/assets/faq.md)
2023-12-28 13:11:18 +08:00
linux cuda环境搭建可以参考这篇文章 https://zhuanlan.zhihu.com/p/674972886
2023-12-19 09:41:52 +08:00
2024-05-02 20:32:28 +08:00
## 2. Quick Start
2024-06-02 22:25:19 +08:00
默认采用ernerf模型webrtc推流到srs
2024-06-22 16:11:44 +08:00
### 2.1 运行srs
2023-12-19 09:41:52 +08:00
```
2024-05-02 20:32:28 +08:00
export CANDIDATE='<服务器外网ip>'
docker run --rm --env CANDIDATE=$CANDIDATE \
-p 1935:1935 -p 8080:8080 -p 1985:1985 -p 8000:8000/udp \
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:5 \
objs/srs -c conf/rtc.conf
2023-12-19 09:41:52 +08:00
```
2024-01-13 20:12:08 +08:00
### 2.2 启动数字人:
2023-12-19 09:41:52 +08:00
2023-12-28 13:11:18 +08:00
```python
python app.py
2023-12-19 09:41:52 +08:00
```
2023-12-28 13:11:18 +08:00
如果访问不了huggingface在运行前
2023-12-19 09:41:52 +08:00
```
2023-12-28 13:11:18 +08:00
export HF_ENDPOINT=https://hf-mirror.com
2023-12-19 09:41:52 +08:00
```
2024-06-10 13:10:21 +08:00
用浏览器打开http://serverip:8010/rtcpushapi.html, 在文本框输入任意文字,提交。数字人播报该段文字
2024-05-02 20:32:28 +08:00
备注:服务端需要开放端口 tcp:8000,8010,1985; udp:8000
2024-01-28 07:58:46 +08:00
2024-03-31 12:01:28 +08:00
## 3. More Usage
2024-08-23 23:19:38 +08:00
使用说明: <https://livetalking-doc.readthedocs.io/>
2024-01-13 20:15:09 +08:00
2024-03-23 18:15:35 +08:00
## 4. Docker Run
2024-06-17 08:21:03 +08:00
不需要前面的安装,直接运行。
2024-01-07 14:19:21 +08:00
```
2024-06-22 16:11:44 +08:00
docker run --gpus all -it --network=host --rm registry.cn-beijing.aliyuncs.com/codewithgpu2/lipku-metahuman-stream:vjo1Y6NJ3N
2024-01-07 14:19:21 +08:00
```
2024-06-17 08:21:03 +08:00
代码在/root/metahuman-stream先git pull拉一下最新代码然后执行命令同第2、3步
2024-01-07 14:19:21 +08:00
2024-09-03 20:43:30 +08:00
提供如下镜像
- autodl镜像: <https://www.codewithgpu.com/i/lipku/metahuman-stream/base>
2024-05-30 11:39:43 +08:00
[autodl教程](autodl/README.md)
2023-12-19 09:41:52 +08:00
2024-06-09 09:04:04 +08:00
2024-08-23 23:19:38 +08:00
## 5. 性能分析
2024-01-13 20:12:08 +08:00
1. 帧率
2024-09-08 22:53:37 +08:00
在Tesla T4显卡上测试整体fps为18左右如果去掉音视频编码推流帧率在20左右。用4090显卡可以达到40多帧/秒。
2024-01-13 20:12:08 +08:00
2. 延时
整体延时3s左右
1tts延时1.7s左右目前用的edgetts需要将每句话转完后一次性输入可以优化tts改成流式输入
2wav2vec延时0.4s需要缓存18帧音频做计算
2024-05-02 20:32:28 +08:00
3srs转发延时设置srs服务器减少缓冲延时。具体配置可看 https://ossrs.net/lts/zh-cn/docs/v5/doc/low-latency
2024-01-13 20:12:08 +08:00
2024-08-03 17:26:35 +08:00
2024-08-23 23:19:38 +08:00
## 6. TODO
2024-01-28 07:58:46 +08:00
- [x] 添加chatgpt实现数字人对话
2024-02-25 19:00:10 +08:00
- [x] 声音克隆
2024-05-04 10:10:41 +08:00
- [x] 数字人静音时用一段视频代替
2024-05-26 18:07:22 +08:00
- [x] MuseTalk
2024-06-17 08:21:03 +08:00
- [x] Wav2Lip
2024-08-03 17:26:35 +08:00
- [ ] TalkingGaussian
2023-12-19 09:41:52 +08:00
2024-08-23 23:19:38 +08:00
---
如果本项目对你有帮助帮忙点个star。也欢迎感兴趣的朋友一起来完善该项目.
* 知识星球: https://t.zsxq.com/7NMyO 沉淀高质量常见问题、最佳实践经验、问题解答
* 微信公众号:数字人技术
2024-06-02 22:25:19 +08:00
![](https://mmbiz.qpic.cn/sz_mmbiz_jpg/l3ZibgueFiaeyfaiaLZGuMGQXnhLWxibpJUS2gfs8Dje6JuMY8zu2tVyU9n8Zx1yaNncvKHBMibX0ocehoITy5qQEZg/640?wxfrom=12&tp=wxpic&usePicPrefetch=1&wx_fmt=jpeg&amp;from=appmsg)
2024-06-09 09:04:04 +08:00