Tried to run deepstream-test1-rtsp-out.py but failed to show the RTSP result on flask website

Please provide complete information as applicable to your setup.

Hardware Platform (Jetson / GPU)
Jetson NX

• DeepStream Version
5.1

• JetPack Version (valid for Jetson only)
4.5-b129

• TensorRT Version
7.1.3

• Issue Type( questions, new requirements, bugs)
After correctly running

python3 deepstream_test1_rtsp_out.py -i ../../../samples/streams/sample_720p.h264 

Basically, there should be a rtsp stream on rtsp://localhost:8554/ds-test , is that righht?

And I am trying that output the rtsp stream on website with cv2 and flask. The code that I use is

from flask import Flask, render_template, Response
import cv2
from gevent.pywsgi import WSGIServer
import os

app = Flask(__name__)

print(cv2.getBuildInformation())
os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transort;udp"

camera = cv2.VideoCapture('rtsp://myusername:mypassword@localhost:8554/ds-test', cv2.CAP_FFMPEG)  # use 0 for web camera
#  for cctv camera use 
# for local webcam use cv2.VideoCapture(0)

def gen_frames():  # generate frame by frame from camera
    while True:
        # Capture frame-by-frame
        success, frame = camera.read()  # read the camera frame
        if not success:
            break
        else:
            ret, buffer = cv2.imencode('.jpg', frame)
            frame = buffer.tobytes()
            yield (b'--frame\r\n'
                   b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')  # concat frame one by one and show result


@app.route('/video_feed')
def video_feed():
    #Video streaming route. Put this in the src attribute of an img tag
    return Response(gen_frames(), mimetype='multipart/x-mixed-replace; boundary=frame')


@app.route('/')
def index():
    """Video streaming home page."""
    return render_template('index.html')


if __name__ == '__main__':
    #app.run(debug=True)
    app.debug = True
    http_server = WSGIServer(('0.0.0.0', 8888), app)
    http_server.serve_forever()

but got the error,

[rtsp @ 0x5597e22600] method DESCRIBE failed: 503 Service Unavailable
rtsp://localhost:8554/ds-test: Server returned 5XX Server Error reply

Any comments on this? Please share with me!

Do you run the python script in the same device as the deepstream app? Why do you set username and password?

@Fiona.Chen,

Yes, I set the script in the same device (NX), I had also tried

rtsp://localhost:8554/ds-test 

it printed the same error message.

Have you installed ffmpeg in your board? Can you see rtsp://localhost:8554/ds-test with ffmpeg in your board directly?

@Fiona.Chen,

Yes, ffmpeg already installed. What’s the commad to use ffmpeg to see rtsp?

ffmpeg Documentation