콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
13247 화면

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.

아바타
취소
베스트 답변

Yes any updates on this? 

아바타
취소
베스트 답변

hi james did you solve this issue?

아바타
취소
관련 게시물 답글 화면 활동
1
7월 21
7300
0
4월 20
4039
1
5월 18
2480
0
4월 18
2901
4
3월 25
3239