没有合适的资源?快使用搜索试试~ 我知道了~
通过python与ffmpeg结合使用,可生成进行视频点播、直播的压力测试脚本。可支持不同类型的视频流,比如rtmp或者hls形式。 通过如下方式执行脚本:python multiRealPlay.py [rtmp|http] [thread counts] [interval Time] [rtmp | http]:视频播放的不同形式 [thread counts]:并发线程数 [interval Time]:启动每个线程的间隔时间 代码: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2015年7月22日 @au
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/release/download_crawler_static/13765897/bg1.jpg)
python+ffmpeg视频并发直播压力测试视频并发直播压力测试
通过python与ffmpeg结合使用,可生成进行视频点播、直播的压力测试脚本。可支持不同类型的视频流,比如rtmp或者hls形
式。
通过如下方式执行脚本:python multiRealPlay.py [rtmp|http] [thread counts] [interval Time]
[rtmp | http]:视频播放的不同形式
[thread counts]:并发线程数
[interval Time]:启动每个线程的间隔时间
代码:
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on 2015年7月22日
@author: LiBiao
'''
import datetime,time
import threading
import subprocess
import os, base64
import sys
import Queue
queue = Queue.Queue()
#需要手动配置的参数
#启动序号
SLEEP_TIME = 0
#直播地址
FULL_ADDR = {}
#需要手动配置的参数
RTMP_ADDR = 'rtmp://192.168.1.208:1935/live/'
HTTP_ADDR = 'http://192.168.1.208:80/live'
liveID = '100002750' #来自于万视无忧中创建的直播
urlKey = 'a1e5c680f7bfc85851de8ab2e63b0a33' #来自于万视无忧安全设置模块
liveResCode = '71ac6c06d3' #直播源码
#生成MD5值
def getMD5_Value(inputdata):
try:
import hashlib
hash = hashlib.md5(inputdata.encode('utf-8'))
except ImportError:
#for python << 2.5
import md5
hash = md5.new()
return hash.hexdigest()
#直播地址组装
def build_live_addr():
t = time.strftime('%Y%m%d%H%M%S',time.localtime())[2:] data = '%s#%s#%s' %(liveID, t, urlKey)
secret = getMD5_Value(data)
rtmp_addr = '%s%s?liveID=%s&time=%s&secret=%s' %(RTMP_ADDR, liveResCode, liveID, t, secret)
http_addr = '%s/%s/playlist.m3u8?liveID=%s&time=%s&secret=%s' %(HTTP_ADDR, liveResCode, liveID, t, secret)
FULL_ADDR['rtmp'] = rtmp_addr
FULL_ADDR['http'] = http_addr
return FULL_ADDR
#获取本机ip地址,用来产生区别于其他机器的数据
def get_local_ip():
try:
ip = os.popen("ifconfig | grep 'inet addr' | awk '{print $2}'").read()
ip = ip[ip.find(':') + 1:ip.find('')] except Exception,e:
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- 春雪里2021-11-05还以为是高手呢,都是照搬人家的
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
weixin_38611527
- 粉丝: 8
- 资源: 903
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)