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

WYZE camera RTSP with MjpegSnapshotsMaker Issues #53

Open Chedberg84 opened 4 years ago

Chedberg84 commented 4 years ago

Describe the bug This isn't so much a bug as it is a question. I'm using a WYZE camera with RTSP setup. What I'm trying to accomplish is saving an image off of the stream to a file. When I run the MjpecSnapShotsMaker code, a file is never saved. I think this is due to the type of frame that is being picked up. The code is exiting here:

if (!(frame is RawJpegFrame)) return;

and I believe it's because the type of frame being picked up is either RawH264IFrame or RawH264PFrame. Do you have any suggestions on how to make this work? I probably just don't understand something because I'm trying to do this as a hobby project.

To Reproduce

  1. Setup WYZE camera RTSP stream
  2. Run MjpecSnapShotsmaker code here: https://github.com/BogdanovKirill/RtspClientSharp/blob/master/Examples/MjpegSnapshotsMaker/Program.cs

Expected behavior Take a RTSP stream and save images off of it to disk.

Desktop (please complete the following information):

BogdanovKirill commented 4 years ago

Hello!

Thank you for your question. MjpegSnapshotsMaker is simple program which could work only with JPEG frames from camera. In case of H264 you need to re-encode video to JPEG format. It means that all H264 frames should be decoded and some of them (or even all) must be encoded to JPEG

BogdanovKirill commented 4 years ago

Any news? Could you change video format to JPEG on that camera?

Chedberg84 commented 4 years ago

Just following up, I don't think a WYZE cam supports JPEG frames. Looks like i'm going to have to find a way to decode a H264 stream and then capture individual frames from the decoded data. Any ideas on that would be great.

Chedberg84 commented 4 years ago

Hi @BogdanovKirill

I pulled down the working branch from https://github.com/inzi/rtspcapture and it worked with my camera! Super excited about that. I don't know if there is any way you can incorporate some of that code into your examples for capturing an image off of a H264 stream? The repository doesn't have a license on it so I've added an issue for inzi to please add one, like MIT would be ideal.

Now, the inzi code is dotnet framework, and I think next I'd like to try to convert it to a dotnet core project. Any thoughts on that?

BogdanovKirill commented 4 years ago

Hello,

You could take my commit https://github.com/inzi/rtspcapture/commit/bdfaea3eff8cd286082814e9f1e820a93e98aa41 and use it under MIT.

Chedberg84 commented 4 years ago

When I pull your commit and try to build locally I get the following error.

"cannot open file avcodec.lib"

Chedberg84 commented 4 years ago

Do you see the same error when pulling down your commit? I'm building with Visual Studio 2017 on Windows 10. It's failing to build the libffmpeghelper project.

BogdanovKirill commented 4 years ago

Please just get some changes from this commit manually and try to use latest code in by master brunch.