ngraziano / SharpRTSP

A RTSP handling library
Other
538 stars 180 forks source link

SharpRTSP work with files? #40

Closed Dokman closed 5 years ago

Dokman commented 6 years ago

So if i want to stream a video with a presentation inside is possible?

RogerHardiman commented 6 years ago

There are no examples for reading video or audio from a file - just an example of receiving video and audio and saving it to a file. If you wanted to add something as an example it would not be too hard and we could merge you code into the project

Dokman commented 6 years ago

okay i'll make a try or something.

RogerHardiman commented 6 years ago

What format are you planning to use for the video file? MP4 or .264 or something else?

Dokman commented 6 years ago

mp4 and matroska, but i need a way to read it, so i'll find an algorithm, cause i only need to stream it and the player will do the rest

RogerHardiman commented 6 years ago

So there are several parts to this. 1) You need to open the container file (mp4 or mkv) and extract the compressed video data for each frame of video. It will already be compressed (probably H264 in a format called NALs)

2) Then you can look at the RTSP Camera Example. That example generates some video and feeds it into a very simple H264 compressor to get h264 data (called NALs). The example then sends the NALs. So you will need to read the NALs from the MP4 or MVK file and then you can use the part of the RTSP Camera Example that sends NALs to transmit the video.

(note live555 has code to read files and stream via RTSP if that is any use. I work on SharpRTSP as I have some projects where I need it all in c# either to simplify debugging or due to licences and app store limitations)

Dokman commented 6 years ago

i have the same problem as you XD so for this reason i have to use c#

Dokman commented 6 years ago

and i have problems with net7mma cause there is no integration about files and i am having a lot of troubles if i open my own apache to stream it

RogerHardiman commented 6 years ago

There is some file handling code here https://github.com/juliusfriedman/net7mma/tree/master/Containers

MP4 is known as BaseMedia

RogerHardiman commented 6 years ago

Found another library in c# - 3 clause BSD licence so that is easy to work with

https://github.com/jeremypoulter/basemedia

Dokman commented 6 years ago

@RogerHardiman when i use rtspSource("livestreamname",new Uri("http://localhost/test.mp4")) doesn't work, so i am f***ed up.

RogerHardiman commented 6 years ago

Sorry, don't know what you mean by 'rtspSource' Which library is that function in?

RogerHardiman commented 5 years ago

There are no examples to read from a file and send via RTSP and I don't have time to write one. So I'll close this Issue.