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(六)

相关推荐
Tony Bai1 天前
高并发后端:坚守 Go,还是拥抱 Rust?
开发语言·后端·golang·rust
wjs20241 天前
Swift 类型转换
开发语言
秃了也弱了。1 天前
python实现定时任务:schedule库、APScheduler库
开发语言·python
Dfreedom.1 天前
从 model(x) 到__call__:解密深度学习框架的设计基石
人工智能·pytorch·python·深度学习·call
weixin_440730501 天前
java数组整理笔记
java·开发语言·笔记
weixin_425023001 天前
Spring Boot 配置文件优先级详解
spring boot·后端·python
Thera7771 天前
状态机(State Machine)详解:原理、优缺点与 C++ 实战示例
开发语言·c++
niucloud-admin1 天前
java服务端——controller控制器
java·开发语言
小徐Chao努力1 天前
【Langchain4j-Java AI开发】06-工具与函数调用
java·人工智能·python
无心水1 天前
【神经风格迁移:全链路压测】33、全链路监控与性能优化最佳实践:Java+Python+AI系统稳定性保障的终极武器
java·python·性能优化