Trợ giúp


How to live rtsp camera in Odoo


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

import cv2

class VideoCamera(object):

def __init__(self): = cv2.VideoCapture("rtsp://")

def __del__(self):

def get_frame(self):

success, image =

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


from flask import Flask, render_template, Response

from camera import VideoCamera

app = Flask(__name__)


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')


def video_feed():

return Response(gen(VideoCamera()),

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

if __name__ == '__main__':'', debug=True)

- index.html



<title>Video Streaming</title>


<body style="margin:0px">

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



thank you very much.

Ảnh đại diện
Huỷ bỏ
1 Trả lời
paidy kumar
Best Answer

hi james did you solve this issue?

Ảnh đại diện
Huỷ bỏ