Skip to Content
Menú
This question has been flagged
2 Respostes
13674 Vistes

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.

Avatar
Descartar
Best Answer

Yes any updates on this? 

Avatar
Descartar
Best Answer

hi james did you solve this issue?

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de jul. 21
7809
0
d’abr. 20
4482
1
de maig 18
2759
0
d’abr. 18
3264
4
de març 25
3538