Giter Club home page Giter Club logo

Comments (1)

nypyp avatar nypyp commented on June 8, 2024

step1 编译python_rtmpstream

安装ffmpeg

pip install ffmpeg并不会在env_name/lib中下载对应的.so文件,例如libavcodec.so等,所以需要使用conda install ffmpeg:

conda install -c conda-forge ffmpeg #安装最新版ffmpeg,成功编译版本ffmpeg=5.1.2

编译rtmp_streaming

如果系统环境中安装了ffmpeg并在系统环境目录下有libavcodec.so等文件的系统路径例如/usr/local/include/等,会优先使用系统路径下的文件进行编译,就算配置了find_library也没用,可以使用message给出编译时具体使用库的地址:

message(STATUS "AVCODEC_LIBRARY: ${AVCODEC_LIBRARY}")
message(STATUS "AVFORMAT_LIBRARY: ${AVFORMAT_LIBRARY}")
message(STATUS "AVUTIL_LIBRARY: ${AVUTIL_LIBRARY}")
message(STATUS "SWSCALE_LIBRARY: ${SWSCALE_LIBRARY}")
#可以使用cmake指令打印编译信息
mkdir build && cd build
cmake

如果系统路径安装了那些库,则会优先使用系统路径编译,但系统路径下的库版本未知编译的python包可能会报flv格式以及音频格式未知等问题导致推流失败:

[INFO] frame_to_text... 
[INFO] warm-up done, actual latency = 2.698054s
[NULL @ 0x7f91eacabea0] Requested output format 'flv' is not a suitable output format #视频流编解码问题
[NULL @ 0x7f91eacabea0] Requested output format '-l' is not a suitable output format #音频流编解码问题
[INFO] frame_to_text... 

所以最好使用conda安装的ffmpeg所使用的库文件,在CMakeList中使用set语句可以配置库使用具体路径:

set(AVCODEC_LIBRARY "/home/nypyp/miniconda3/envs/nerfstream/lib/libavcodec.so")
set(AVFORMAT_LIBRARY "/home/nypyp/miniconda3/envs/nerfstream/lib/libavformat.so")
set(AVUTIL_LIBRARY "/home/nypyp/miniconda3/envs/nerfstream/lib/libavutil.so")
set(SWSCALE_LIBRARY "/home/nypyp/miniconda3/envs/nerfstream/lib/libswscale.so")

修改tese_stream

执行pip后,修改tese_stream.py为播放本地文件:

cap = cv2.VideoCapture("/home/nypyp/code/srs/trunk/doc/source.flv")

安装pyaudio

sudo apt-get install portaudio19-dev python-all-dev python3-all-dev 
#pyaudio pip 安装会报fatal error: portaudio.h: No such file or directory,所以需要先安装前置库
pip install pyaudio
#apt 安装报错下列软件包有未满足的依赖关系:portaudio19-dev : 依赖: libasound2-dev 但是它将不会被安装
#换conda 安装
conda install pyaudio

step2 metahuman-stream

metahuman-stream install

pip install tensorflow-gpu==2.8.0 #报错,依赖冲突
pip install tensorflow-gpu==2.8.1

docker run

非root用户启动docker

参考博客:非root用户启动docker

ERROR: Got permission denied while trying to connect to the Docker daemon socket

#解决办法:添加用户到docker组
sudo groupadd docker #添加docker组
sudo gpasswd -a username docker #将用户username添加到组
id #查看用户所在的组
newgrp docker #如果未在组中,在用户终端下使用newgrp用刷新用户组
docker 假死进程占用端口

参考博客:Cannot stop or restart a docker container

sudo systemctl restart docker.socket docker.service
docker rm -f <container id>

运行app.py出现的问题

pip install protobuf==3.20 #需要降级protobuf

websocket问题,参考issues:metahuman-stream issues

#werkzeug mismatcher websocket问题
#python/site-packages/werkzeug/routing/matcher.py,注释websocket_mismatch = True
#修改python/site-packages/flask_sockets.py

self.url_map.add(Rule(rule, endpoint=f)) #改成
self.url_map.add(Rule(rule, endpoint=f, websocket=True))

nginx端口占用问题

lsof -i:8000
kill -9 PID

from metahuman-stream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.