Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve snapshot quality (lower compression) / export still picture from stream? #19

Closed
mrandt opened this issue Mar 5, 2024 · 5 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@mrandt
Copy link

mrandt commented Mar 5, 2024

Is your feature request related to a problem? Please describe:

I bought a UVC-G5-Pro and mounted it to the tower of my flying club's airfield. We primarily want to use it as a "netcam" and upload a picture once a minute to our website, for pilots to judge weather condition or just admire the glider planes ;-)

This seems awkwardly difficult to achieve. The "anonymous snapshot" feature of the cam itself only returns 640px width and very highly compressed images - bummer.

I started researching and found no easy way to export still pictures from Unifi Protect nor the cam.

Finally, I came across this library. Thanks a lot for making this! I learned enough NodeJS to get it to call the "getSnapshot" via Unifi Protect API last night.

Now I can obtain 3840x2160 px resolution snapshot, but the pictures are still heavily compressed and look terrible...

Describe the solution you'd like:

I would liked to reduce JPEG compression on the getSnapshot returned image - or set it to a higher quality at least.

I am unsure if Unifi has necessary parameters, fiddling with the UI I could not find any. For playback it seems multiple channels with different compressions are supported, but I was not successful applying those params to the snapshot endpoint.

Describe alternatives you've considered:

If Unifi Protect snapshot endpoint does in fact not provide better quality image, an alternative approach might be to extract a higher quality still picture from the video stream. But I honestly don't know how to do that.

Maybe a convienience method could be added to the stream API?

Additional context:

I am attaching two JPEG show the problem. One was obtained through snapshot service, the other was exported from Unifi Protect UI. You also see a big difference in file size.

Snapshot:

snapshot_from_API

Still picture taken from Unifi Protect UI:

still_picture_taken_from_Unifi_Protect_UI

@mrandt mrandt added the enhancement New feature or request label Mar 5, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 12, 2024
@mrandt
Copy link
Author

mrandt commented Mar 12, 2024

I was in contact with Unifi. As the API is not intended for 3rd party use, they would not comment on parameters / usage.

Also, they could not tell me wether they would "fix" the anonymous snapshot.

I have posted a feature request to Unifi community forums, asking for a feature to expose still pictures in configurable resolution / compression.

Read it here - maybe you care to "upvote"?

https://community.ui.com/questions/Feature-Request-Export-still-static-pictures-from-Unifi-Protect-e-g-for-webcam-website-integration/7be6eaea-03af-4a5a-bc7e-4c0f22b8ebd6

@hjdhjd Would you have any pointers as to how I could use the video stream and extract a single frame / still picture with your API client? Greatly appreciated!

@mrandt mrandt closed this as completed Mar 12, 2024
@mrandt mrandt reopened this Mar 12, 2024
@github-actions github-actions bot removed the stale label Mar 12, 2024
@mrandt
Copy link
Author

mrandt commented Mar 12, 2024

Sorry, did not intend to close.

@hjdhjd hjdhjd closed this as completed Mar 12, 2024
@hjdhjd
Copy link
Owner

hjdhjd commented Mar 12, 2024

Thanks for the request - I'll look into this as time allows in the near future, but I'm closing for this one for the time being. I'm certainly interested in improving snapshot quality...I appreciate you doing some homework to track down some of the detail of this.

Having looked into it a bit further - this is an API choice by Ubiquiti. If there’s a way to produce snapshot images directly from the API that’s of higher quality, happy to look into it. Otherwise, this is what the API produces.

Your alternatives are to generate a thumbnail using FFmpeg which the links you’ve shared also point you toward. It does work, at the expense of a small performance hit on modern systems. Best of luck.

@hjdhjd hjdhjd added the wontfix This will not be worked on label Mar 13, 2024
Copy link

This issue is locked to prevent necroposting on closed issues. Please create a new issue for related support requests, bug reports, or feature suggestions.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants