python_rtmpstream - Python rtmp 推流

文章目录


一、关于 python_rtmpstream

python_rtmpstream 基于ffmpeg api函数实现推送rtmp流,实现了音视频同步。


二、安装

1、下载代码

shell 复制代码
git clone https://github.com/lipku/python_rtmpstream.git
cd python_rtmpstream
git submodule update --init

2、安装依赖库

shell 复制代码
pip install wheel
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda install ffmpeg 
或者 apt install libavcodec-dev libavformat-dev libswscale-dev

3、修改 python/CMakeLists.txt 文件, 根据python和ffmpeg安装路径修改如下部分(这一步一定要做,很多错误都是这里没改引起的)

shell 复制代码
set(PYTHON_EXECUTABLE /opt/anaconda3/envs/python37/bin/python)  #python bin dir

include_directories("/opt/anaconda3/envs/python37/include") #ffmpeg include dir
find_library(AVCODEC_LIBRARY avcodec /opt/anaconda3/envs/python37/lib) #ffmpeg lib dir
find_library(AVFORMAT_LIBRARY avformat /opt/anaconda3/envs/python37/lib)
find_library(AVUTIL_LIBRARY avutil /opt/anaconda3/envs/python37/lib)
find_library(SWSCALE_LIBRARY swscale /opt/anaconda3/envs/python37/lib)

如果是 python3.10 以下,不能用相对路径,需要将如下部分改成绝对路径

shell 复制代码
include_directories("../streamer")

pybind11_add_module( ../streamer/streamer.cpp) 

4、安装python库

shell 复制代码
cd python
pip install .

三、运行测试程序

shell 复制代码
python test_stream.py

更多详细使用请参考 https://github.com/lipku/nerfstream


2024-08-03(六)

相关推荐
Dxy12393102161 小时前
python如何通过链接下载保存视频
python·spring·音视频
Terio_my1 小时前
Java bean 数据校验
java·开发语言·python
Tony Bai1 小时前
【Go开发者的数据库设计之道】07 诊断篇:SQL 性能诊断与问题排查
开发语言·数据库·后端·sql·golang
超级大只老咪2 小时前
何为“类”?(Java基础语法)
java·开发语言·前端
我笑了OvO2 小时前
C++类和对象(1)
java·开发语言·c++·类和对象
无咎.lsy2 小时前
裸K初级篇 - (一)蜡烛突破信号
python
可触的未来,发芽的智生4 小时前
新奇特:神经网络的集团作战思维,权重共享层的智慧
人工智能·python·神经网络·算法·架构
渡我白衣4 小时前
C++ 异常处理全解析:从语法到设计哲学
开发语言·c++·面试
jerryinwuhan5 小时前
Python数据挖掘之基础分类模型_支持向量机(SVM)
python·支持向量机·数据挖掘
StarPrayers.5 小时前
基于PyTorch的CIFAR10加载与TensorBoard可视化实践
人工智能·pytorch·python·深度学习·机器学习