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
[Camera]: Record video while Image Stream process #83634
Comments
|
I want to make a driving recorder app, do "object detect" and "video recording" at the same time, how can I solve it ? |
In Android, I solve it using a platform channel and CameraX as a workaround, it is not the best option but I needed a solution |
|
I have the same requirement. Is there any other plugin that can do this |
|
I found a temporary solution,modify the plugin two places 1-1: dart side: in startImageStream()&&stopImageStrea() method, Delete the crash code where isRecordingvide is true 2-1: java side: in camera.java file, found startVideoRecording() method, replace |
|
In addition, when the iOS phone calls StartVideoRecording and StopVideoRecording at the same time, it will occasionally crash and the recorded video cannot be played |
|
At this time, Flutter plugin can record video while Image Stream process Usage of Flutter: just call startVideoRecording/stopVideoRecording and startImageStream/stopImageStream at same time |
|
Great @hellozsh! I should check this out. The only side problem here is that you need to start record and start stream at the same time? Good enough for me anyway, you can stream images and restart the stream with video whenever you need it. |
|
Another thing you can do is have imageStream, preview and recording all at different sizes. For example you need a 320*240 image stream for ML inference but still want to record FullHD you can add in Camera.java to It is somewhat strange that one part of Google is pushing the ML angle very hard with Tensorflow and creating all sorts of abstractions on top of it native side. And yet the Flutter team does not even provide proper tools to take advantage of their own products. |
|
Is there any plan to get this done in the official plugin in the future? |
|
@Kypsis is it right to modify Camera.java that is in project folder - ios - .symlinks - plugins - camera - android -src -main - java - io -flutter - plugins -camera -Camera.java ? Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.9.4+5/android/src/main/java/io/flutter/plugins/camera/Camera.java:166: error: cannot find symbol it cause above error on compile. |
|
@ianloic Were u able to find any solution for this problem? |
|
I want to know how to record video in Image Stream. I am using ML now. When using Image Stream, I need to record video, but camera cannot be used at the same time |
Hi, I'm glad to see this answer, I want to know how to deal with it in iOS? I didn't find the right way |
|
I also need to do the same thing; face detection and video recording. But the main issue right now is that I have added some face contours to be able to show the bounding box, and those are not being tracked or traced along with the face after I made the above change to the camera.java code. Any solution for it? |
|
@np8698 I know it's not the easiest way, but I made final video frame by frame using the ffmpeg flutter wrapper, that's an option |
Hello, did you find a solution? I also need this functionality. Thanks |
@ianholing Yes, I intend to do the same. Right now, i have the list of images which I obtained by converting the yuv images ( or CameraImage ) to RGB. Now with ffmpeg i am not able to understand how to get the path for these images and combine them. If possible could you help me out ? |
|
@ianholing can you please show the example for it |
|
Of course.. In my use case in AvatART App, FPSs could be low depending on the phone because we use a heavy custom model and the usage of GPUs/CPUs could be really intensive, so.. we decided to recreate all the frames with the actual video recorded with a usual framerate and without the IA processing, this way the output feels really smooth: https://gist.github.com/ianholing/8d416f2bde6e4402c787731f655db19b Hope it helps :) if anyone could even test the App and give me a review in the store I would really appreciate it, I am in the middle of the ASO process right now :P Marketing hat today |
|
@ianholing Does your solution work with:
all at once? Or do you process video stream after video is recorded already? |
|
In fact, the response for both are "yes", let me explain:
|
|
@ianholing Yeah, that's what I'm afraid of given that I try to make a video using images stream, the audio would be unsynchronized in case of frame-dropping. I need to record a video and analyze it in real-time while recording to detect some changes on it (I may lose some frames, that's not a problem), that's why I'm curious if you managed to do it somehow. I also tried to record a video, and while recording, take pictures periodically using camera, and analyze such pictures. That seems to work on iOS, but crashes app on Android. My another attempt was to picture CameraPreview widget every second and analyze such a picture. I thought it was a good-enough solution, but it turns out Flutter does not allow to make pictures out of PlatformViews using RepaintBoundary #25306 Screenshot of an app is not a solution for me sadly. I need to think more on how to solve it :D |
There are also other solutions at the beginning of this thread for use a modified version of Camera Flutter plugin, have you tried that? |
|
Not yet, once I get to native code modifications, I will definitely try the solutions above. |
ianholing commentedMay 30, 2021
Record video while Image Stream process is working
I'm pretty sure this is a common problem in a lot of applications and not a strange and isolated request. I am developing an application to create face filters so I need to process each image to get the face keypoints, but if I do that, there is no way to record a vídeo. It is simply useless if I can't record it.
I don't care if the video is recorded with the processed images or not, I can do it later again, but at least have that video somewhere.
The thing here is there is not a workaround, If you want to record video and process images, you should create a new plugin.
Proposal
I don't know how difficult it is or why, but it is definitely possible. There are applications in the market doing that and other Flutter plugins capable of that also like https://pub.dev/packages/rtmp_publisher or https://github.com/mtellect/CameraDeepAR
I don't think this should be an external package but a feature of the actual camera plugin.
The text was updated successfully, but these errors were encountered: