Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
13242 Weergaven

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
Annuleer
Beste antwoord

Yes any updates on this? 

Avatar
Annuleer
Beste antwoord

hi james did you solve this issue?

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
jul. 21
7298
0
apr. 20
4038
1
mei 18
2478
0
apr. 18
2898
4
mrt. 25
3239