BogdanovKirill / RtspClientSharp

Pure C# RTSP client for .NET Standard without external dependencies and with true async nature. I welcome contributions.
MIT License
706 stars 284 forks source link

Reading h264 data without decoding ? #68

Open hagaygo opened 4 years ago

hagaygo commented 4 years ago

Hi

I checked out the examples.

Everything basically working with my ip cam rtsp url.

My IP cam has movement detection feature that can "wake" other process when movement is detected.

What i am hoping to achieve is to write a daemon using c# .net core to run on one of my raspberry pie(s) which holds undecoded h264 frames. (keeps a buffer of last X seconds)

Now when the camera detects movement it signals this daemon and it will create mp4 video with lets say 5 seconds before the signal and 15 seconds after it.

I can do quite easily all of the above except creating mp4 file with the video copy of the camera stream.

Is it possible at all ? preferably without using external libraries and without decoding/re-encoding.

Thanks in advance for any help.

BogdanovKirill commented 4 years ago

Hi!

You could write undecoded frames into your own file format and the read it. Or you could try to use MP4 muxer in ffmpeg lib and put all frames to that muxer through pinvoke.

hagaygo commented 4 years ago

Thanks for your reply.

I tried looking into writing encoded frames to mp4 using ffmpeg.

No success yet, not sure its possible.