Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
13235 Lượt xem

I'm beginner in odoo.

I want create module live stream rtsp in odoo (ip camera)

I tried stream rtsp python using opencv and Flask. It working.

Now, I try with odoo but not working. I think function url_for("function_name") not working 
Does this exist in Odoo? I can't find it or any alternatives.

Code with open cv and Flask
- camera.py

import cv2

class VideoCamera(object):

def __init__(self):

self.video = cv2.VideoCapture("rtsp://192.168.137.71:8080/h264_pcm.sdp")

def __del__(self):

self.video.release()

def get_frame(self):

success, image = self.video.read()

# We are using Motion JPEG, but OpenCV defaults to capture raw images,

# so we must encode it into JPEG in order to correctly display the

# video stream.

ret, jpeg = cv2.imencode('.jpg', image)

return jpeg.tobytes()


- main.py

from flask import Flask, render_template, Response

from camera import VideoCamera

app = Flask(__name__)

@app.route('/')

def index():

return render_template('index.html')

def gen(camera):

while True:

frame = camera.get_frame()

yield (b'--frame\r\n'

b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')

@app.route('/video_feed')

def video_feed():

return Response(gen(VideoCamera()),

mimetype='multipart/x-mixed-replace; boundary=frame')

if __name__ == '__main__':

app.run(host='0.0.0.0', debug=True)

- index.html


<html>

<head>

<title>Video Streaming</title>

</head>

<body style="margin:0px">

<img style="width:100%;height: 100%;" id="bg" src="{{ url_for('video_feed') }}">

</body>

</html>

thank you very much.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Yes any updates on this? 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

hi james did you solve this issue?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 21
7296
0
thg 4 20
4036
1
thg 5 18
2477
0
thg 4 18
2898
4
thg 3 25
3239