chriswiggins / rtsp-streaming-server

Lightweight RTSP/RTP streaming media server written in Javascript
GNU General Public License v3.0
106 stars 21 forks source link

Unknown PublishServer request 'DESCRIBE', 'PLAY' #9

Closed bingbing720 closed 5 years ago

bingbing720 commented 5 years ago

Hello. I have implemented simple rtsp server based on your library. I am getting error 'unknown PlublishServer request 'DESCRIBE' and 'PLAY'.

image 'DESCRIBE' and 'PLAY' are standard protocol directives but are they not implemented yet? if so rtsp server is working properly?

chriswiggins commented 5 years ago

Hi @bingbing720 - you need to PUBLISH streams on the PublishServer port, and then PLAY streams on the ClientServer port . Can you show your rtsp.js file?

bingbing720 commented 5 years ago

It's totally same with sample code. I don't know how to implement two features and also couldn't any document about them. Would you share some code ? Thank you.

const RtspServer = require('rtsp-streaming-server').default

const server = new RtspServer({ serverPort: 7004, clientPort: 8004, rtpPortStart: 10000, rtpPortCount: 10000 });

async function run () { try { await server.start(); } catch (e) { console.error(e); } }

run();

chriswiggins commented 5 years ago

So first of all, you need to send a stream into the RTSP server using an application that supports RTSP ANNOUNCE (like ffmpeg):

ffmpeg -re -i video.mp4 -c:v copy -f rtsp rtsp://127.0.0.1:7004/stream1

And then you can watch your stream:

ffplay rtsp://127.0.0.1:8004/stream1

bingbing720 commented 5 years ago

Thank you. I did it. and then when I tried to play rtsp url using vlc player the above issue happened.

chriswiggins commented 5 years ago

What RTSP url did you use in VLC?

bingbing720 commented 5 years ago

it's some snippet of python code. .... command = ['ffmpeg', '-f', 'rawvideo', '-pix_fmt','bgr24', '-s', cam_res, '-r', str(cam_fps), '-i', '-', '-f', 'rtsp', 'rtsp://172.16.1.22:7004/cam1',

'http://localhost:8090/feed1.ffm'

#'-f', 'mpegts', 'output.mp4'
]

proc = sp.Popen(command, stdin=sp.PIPE) ...... proc.stdin.write(frame.tobytes())

After it I opened 'rtsp://172.16.1.22:7004/cam1' through as VLC player network stream. 172.16.1.22 is localhost IP address.

chriswiggins commented 5 years ago

You're using the wrong RTSP port in VLC. Note that there is a port to publish and a port to play

Open rtsp://172.16.1.22:8004/cam1 in VLC (note the 8004 port)

bingbing720 commented 5 years ago

It's working now. Appreciate your help. Thank you so much.

chriswiggins commented 5 years ago

You’re welcome! I realised the documentation was wrong too