-
Notifications
You must be signed in to change notification settings - Fork 42
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
Save video with a few seconds overlaps #22
Comments
Thank you Andras. Indeed, there is a brief delay between the recordings, as the MediaRecorder needs to be stopped and reset before the camera can start a new recording: https://github.com/maxneaga/open_dash_cam_android/blob/master/mobile/src/main/java/com/opendashcam/BackgroundVideoRecorder.java#L192 I wonder if any optimizations can be made to shorten this time (possibly with threads?). I think the time could be significantly reduced to make it less noticeable, but I don't think overlapping is possible, as the camera API does not allow to perform two recordings simultaneously. |
@maxneaga Thank you for the quick reply! I'm more like a .NET developer, so I don't know too much about Android's threading and the limitations of the encoding API, so I'm just asking, do you think triple-buffering could work here? Basically we could have three 3-second long buffers in memory. The camera API would lock and fill first the buffer#1 then buffer#2 then buffer#3 and buffer#1 again and so on. There would be two other threads with the encoders and file writers. As soon a buffer gets released from the API lock, the encoder would start working on it and it would eventually pass it to the file writer, writing the next 3 seconds of the file into the storage. I know that it is typically a case which is easier to imagine working fine, than implementing properly, but still, does it make any sense at all? |
@andrasfuchs I would need to research more about buffering in Android to see how this could work. Thank you for outlining the approach! |
Today I recorded a car which passed the crossing while the traffic light was red. I starred it instantly, but when I got home and I reviewed the recordings, I realized the actual crossing happened at the end of one file and at the beginning of the next. The moment when the case happened is not even on the footage because approximately 1 second is lost between files.
So, I would suggest to save let's say 3-5 seconds of overlap in both files to avoid this.
The text was updated successfully, but these errors were encountered: