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

相关推荐
学IT的小卢6 分钟前
SDL_CreateRendererWithProperties报错Parameter ‘window‘ is invalid
ffmpeg
人衣aoa25 分钟前
Python编程基础(二)| 列表简介
开发语言·python
Forest_HAHA27 分钟前
<5>, Qt系统相关
开发语言·qt
10000hours1 小时前
【存储基础】NUMA架构
java·开发语言·架构
豆沙沙包?1 小时前
2025年- H61-Lc169--74.搜索二维矩阵(二分查找)--Java版
python·线性代数·矩阵
AntBlack1 小时前
计算机视觉 : 端午无事 ,图像处理入门案例一文速通
后端·python·计算机视觉
Freshman小白1 小时前
基于python脚本进行Maxwell自动化仿真
python·自动化
weixin_493202632 小时前
R语言错误处理方法大全
开发语言·r语言
wangyuxuan10292 小时前
AtCoder Beginner Contest 399题目翻译
开发语言·c++·算法
执笔论英雄2 小时前
【Deepseek 学网络互联】跨节点通信global 和节点内通信CLAN保序
开发语言·网络·php