- SRS Wiki 首页
- SRS Arch
- ARM转码
- 带宽测试
- 安装
- 客户端 SDK
- 开源的客户端 SDK
- DeliveryHDS
- Delivery HLS
- Delivery HTTP FLV Stream
- Delivery Method
- 分发 RTMP 流
- HttpServer
- DRM
- DVR
- Edge Server
- 功能列表
- Live Streaming Transcode
- 点播 FLV 流
- Forward For Small Cluster
- GIT
- GPERF 内存和性能分析
- gprof 性能分析
- 心跳
- SRS 支持 HEVC 编码
- SRS 简介
- HTTP API
- HTTP Callback
- SRS Embeded HTTP Server
- 集成开发环境
- 采集
- K8S
- Kafka
- SRS 系统服务
- LiveShow
- LogRotate
- 低延时直播应用
- Exec
- OriginCluster
- Perf性能分析
- Performance Banchmark
- Project
- Performance benchmark for SRS on RaspberryPi
- Reload
- REUSE PORT
- WebRTC
- ATC支持HLS/HDS热备
- 分发方式比较
- RTMP Handshake
- URL Specification
- Use Scenarios
- ARM上部署SRS实例
- DASH部署实例
- Demo的部署
- FFMPEG转码部署实例
- RTMP流转发(Forward)部署实例
- HLS部署实例
- SRS-HTTP服务部署实例
- SRS-HTTP-FLV部署实例
- SRS-HTTP-FLV集群部署实例
- Ingest采集实例
- RTMP源站集群部署实例
- RTMP低延时配置
- RTMP部署实例
- RTMP边缘集群部署实例
- SRT deploy example
- 转码后分发HLS部署实例
- Security
- 服务器端开发脚本
- 开始使用
- Snapshot
- SpecialControl
- SRS提供的librtmp
- SRS for linux-arm
- SRS Log System
- SRT媒体编码支持格式
- SRT参数配置
- SRT直播地址格式简介
- SRT
- Streamer
- TimeJitter
- Web P2P
- Windows下的SRS
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Snapshot
截图有以下几种方式可以实现:
- HttpCallback:使用HTTP回调,收到
on_publish
事件后开启ffmpeg进程截图,收到on_unpublish
事件后停止ffmpeg进程。SRS提供了实例,具体参考下面的内容。 - Transcoder:转码可以配置为截图,SRS提供了实例,具体参考下面的内容。
HttpCallback
下面的实例使用Http回调截图。
先启动实例Api服务器:
python research/api-server/server.py 8085
SRS的配置如下:
# snapshot.conf
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
http_hooks {
enabled on;
on_publish http://127.0.0.1:8085/api/v1/snapshots;
on_unpublish http://127.0.0.1:8085/api/v1/snapshots;
}
ingest {
enabled on;
input {
type file;
url ./doc/source.200kbps.768x320.flv;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled off;
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
}
}
}
启动SRS时,ingest将会推流,SRS会调用Api服务器的接口,开始截图:
./objs/srs -c snapshot.conf
截图生成的目录:
winlin:srs winlin$ ls -lh research/api-server/static-dir/live/*.png
-rw-r--r-- 1 winlin staff 73K Oct 20 13:35 livestream-001.png
-rw-r--r-- 1 winlin staff 91K Oct 20 13:35 livestream-002.png
-rw-r--r-- 1 winlin staff 11K Oct 20 13:35 livestream-003.png
-rw-r--r-- 1 winlin staff 167K Oct 20 13:35 livestream-004.png
-rw-r--r-- 1 winlin staff 172K Oct 20 13:35 livestream-005.png
-rw-r--r-- 1 winlin staff 264K Oct 20 13:35 livestream-006.png
lrwxr-xr-x 1 winlin staff 105B Oct 20 13:35 livestream-best.png -> livestream-006.png
其中,live-livestream-best.png
会软链到尺寸最大的那个截图,避免生成黑屏的截图。
可以通过HTTP访问,譬如:http://localhost:8085/live/livestream-best.png
Transcoder
也可以使用Transcoder直接截图。SRS配置如下:
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine snapshot {
enabled on;
iformat flv;
vfilter {
vf fps=1;
}
vcodec png;
vparams {
vframes 6;
}
acodec an;
oformat image2;
output ./objs/nginx/html/[app]/[stream]-%03d.png;
}
}
ingest {
enabled on;
input {
type file;
url ./doc/source.200kbps.768x320.flv;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled off;
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
}
}
}
启动SRS就可以生成截图:
winlin:srs winlin$ ls -lh objs/nginx/html/live/*.png
-rw-r--r-- 1 winlin staff 265K Oct 20 14:52 livestream-001.png
-rw-r--r-- 1 winlin staff 265K Oct 20 14:52 livestream-002.png
-rw-r--r-- 1 winlin staff 287K Oct 20 14:52 livestream-003.png
-rw-r--r-- 1 winlin staff 235K Oct 20 14:52 livestream-004.png
-rw-r--r-- 1 winlin staff 315K Oct 20 14:52 livestream-005.png
-rw-r--r-- 1 winlin staff 405K Oct 20 14:52 livestream-006.png
注意:SRS没有办法选出最佳的截图。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论