方式1: python rstp推送
原文链接地址
https://www.jianshu.com/p/fcd131c08b0d
import cv2
class VideoCamera(object):
url = "rtsp://admin:admin@192.168.1.37:554/h264/ch1/main/av_stream"
def __init__(self):
#capturing video
self.video = cv2.VideoCapture(self.url)
def __del__(self):
#releasing camera
self.video.release()
def get_frame(self):
#extracting frames
ret, frame = self.video.read()
# encode OpenCV raw frame to jpg and displaying it
ret, jpeg = cv2.imencode('.jpg', frame)
return jpeg.tobytes()
#!/usr/bin/env python
from flask import Flask, render_template, Response, url_for
app = Flask(__name__)
@app.route('/')
def index():
return '''<html>
<head>

本文介绍了四种实现视频流的方式:Python通过RTSP推流、VLC-RTP推流、WebRTC-Streamer展示及萤石云平台播放。作者指出Python方式可能不稳定,WebRTC-Streamer有CPU占用问题,推荐使用萤石云作为稳定展示平台。

2万+

被折叠的 条评论
为什么被折叠?



