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

相关推荐
_一条咸鱼_2 分钟前
Python 语法之注释详解(二)
人工智能·python·面试
whoarethenext4 分钟前
使用c++调用deepseek的api(附带源码)
服务器·开发语言·c++·qt·deepseek
Bczheng14 分钟前
C++ 操作符重载Operator
开发语言·c++
小洛~·~13 分钟前
《深度学习入门:基于Python的理论与实现》第四章神经网络的学习—上篇(损失函数登场)
python·深度学习·神经网络
bjxiaxueliang13 分钟前
一文详解opencv-python环境搭建:Mac配置python的cv2开发环境
python·opencv·macos
用户40937927136819 分钟前
并发编程
python
大樊子23 分钟前
JavaScript 中的单例模式
开发语言·javascript·单例模式
Eugene__Chen32 分钟前
java IO/NIO/AIO
java·python·nio
满怀101533 分钟前
【Python核心库实战指南】从数据处理到Web开发
开发语言·前端·python
andlbds1 小时前
Ubuntu20.04安装Pangolin遇到的几种报错的解决方案
开发语言·c++