Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
947 stars 234 forks source link

Expose video/preview stream #206

Open shpingalet007 opened 1 year ago

shpingalet007 commented 1 year ago

Proposal

Support analysis mode in video mode preview and while recording video.

I want to have access to the video stream while recording video. As I see, that is not supported for now, as the app crashes when switching mode to the video.

Is it difficult to accomplish, or can I access to the stream somehow else?

Thanks in advance!

P.S - CameraAwesome is the best camera solution, in my opinion. Nice work! 😉💪
g-apparence commented 1 year ago

Thanks for feedbacks. That's an interesting improvement. 👍

apalala-dev commented 1 year ago

P.S - CameraAwesome is the best camera solution, in my opinion. Nice work! 😉💪

Thank you!

I explained in #209 that some Android devices can't support both video and analysis at the same time. See my answer.

Analysis mode requires a few improvements that I will work on (start/stop analysis, don't crash if the device doesn't support it or provide a way to know if it does before starting analysis).

Are you trying this on an Android or iOS device?

shpingalet007 commented 1 year ago

@apalala-dev, thanks for your fast response. I'm trying this on my Android device - Honor 8X. I will describe a little what I try to do, maybe I can do that somehow differently.

The idea is to take some random frames from the video stream while video recording is in process, e.g. 1 frame per 5 seconds. As I understand, video preview element receives some frames. Maybe we can take the frames for the analysis from the preview element? This is not the same as I suppose is provided by some Android API related to analysis mode, but anyway, I think it's better than nothing.

Waiting for your professional opinion!

Origogi commented 1 year ago

@apalala-dev @shpingalet007 The cause of this problem is that the analyzed image is imported through CameraX.

Since CameraX doesn't support image analysis during video recording (some cameras), it doesn't seem to solve the problem.

So I think I need an option to get raw image data as a stream, not the analyzed image.

Reference

https://pub.dev/documentation/camera/latest/camera/CameraController/startImageStream.html

shpingalet007 commented 1 year ago

Hi everyone. Are there any changes on this?

apalala-dev commented 1 year ago

I renamed the title of this issue since its focus is more on how to get the video / preview stream (and eventually apply effect on it, sending it through network, etc) than making image analysis work concurrently with video recordings.

Video recordings and image analysis should work, but it does only on some devices. You can take a look at the documentation to learn more about this.

Accessing the real preview/video stream is not currently supported by CameraX so we can't implement it. Image analysis from iOS is similar to this.

In the meantime, you might try to use CameraAwesomeBuilder.analysisOnly() and build the video yourself from the images received, but it will probably be laggy. Check the new helper methods to display analysis images.

CaoGiaHieu-dev commented 1 year ago

@apalala-dev could you provide the way how to trigger record video base on this solution ?

I renamed the title of this issue since its focus is more on how to get the video / preview stream (and eventually apply effect on it, sending it through network, etc) than making image analysis work concurrently with video recordings.

Video recordings and image analysis should work, but it does only on some devices. You can take a look at the documentation to learn more about this.

Accessing the real preview/video stream is not currently supported by CameraX so we can't implement it. Image analysis from iOS is similar to this.

In the meantime, you might try to use CameraAwesomeBuilder.analysisOnly() and build the video yourself from the images received, but it will probably be laggy. Check the new helper methods to display analysis images.