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

相关推荐
学习编程的gas2 小时前
C++面向对象编程入门:从类与对象说起(一)
开发语言·c++
冼紫菜2 小时前
【Spring Boot 多模块项目】@MapperScan失效、MapperScannerConfigurer 报错终极解决方案
java·开发语言·mybatis
Bear on Toilet3 小时前
Bug日记——实现“日期类”
开发语言·c++·bug
apcipot_rain3 小时前
《面向对象程序设计-C++》实验五 虚函数的使用及抽象类
开发语言·c++
小彭律师4 小时前
数字化工厂中央控制室驾驶舱系统架构文档
python
明月看潮生5 小时前
青少年编程与数学 02-019 Rust 编程基础 05课题、复合数据类型
开发语言·青少年编程·rust·编程与数学
幼稚诠释青春5 小时前
Java学习笔记(对象)
java·开发语言
old_power6 小时前
【Python】PDF文件处理(PyPDF2、borb、fitz)
python·pdf
测试开发Kevin6 小时前
从投入产出、效率、上手难易度等角度综合对比 pytest 和 unittest 框架
python·pytest
Wyc724096 小时前
JDBC:java与数据库连接,Maven,MyBatis
java·开发语言·数据库