pedroSG94 / RTSP-Server

Plugin of rtmp-rtsp-stream-client-java to stream directly to RTSP player.
Apache License 2.0
214 stars 66 forks source link

How to use this library with customized video and audio RTP packets #138

Open blueme0 opened 1 month ago

blueme0 commented 1 month ago

Hi Pedro, your library has been a great help to me.

In my project, I am currently receiving audio and video information as RTP packets from external devices through two separate ports via ServerSocket. I would like to utilize these RTP packets directly with the RTSP-Server library. Is that possible? I am looking for a way to relay the received RTP packets to a new port for streaming while controlling the stream using the RTSP-Server.

pedroSG94 commented 3 weeks ago

Hello,

This library can't handle external packets, it is designed to emulate a RTSP server but using internal video/audio source and can't receive clients that send video/audio to the server (pushers), only works with RTSP players.

Actually, you can use RtspServerStream class and create your own VideoSource using that RTP packets but you will need unpaquetize that RTP packets to obtain raw video/audio data and then use a decoder like in this case: https://github.com/pedroSG94/RootEncoder/issues/1584#issuecomment-2395103508

Read the whole post to have more context. In this case the user receive the video from a Rtmp source so you need do the same but before fill the BufferDecoder class with the data received from the ServerSocket you need unpaquetize it and send the full video/audio frames to the BufferDecoder