Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Killing the app before video capture finalization is complete?

49 views
Skip to first unread message

Aubrey Haskett

unread,
Apr 8, 2025, 3:23:58 PMApr 8
to Android CameraX Discussion Group
Hi CameraX!

Wondering if y'all can help me understand how finalization works and if there is any solution I can implement. 

I have a small number recordings where the moov atom is missing. I think this is due to users killing the app AFTER they end the recording (triggering finalization) but BEFORE finalization is complete. I'm pretty sure these are the user actions causing the issue but not 100%: These cases seem to be mostly when the recording is very big (let's say 10GB) and likely takes a while to finalize. 

Are these user actions a possible cause for the issue? I'm not receiving any finalization errors in these cases and I do see these users killed the app quickly after ending the recording so I'm somewhat grasping at straws. If this is a plausible case, is there anything I can do about it? I don't really see a clean way forward with running just the finalization in a background task or anything. 

Thanks,
Aubrey

Leo Huang

unread,
Apr 9, 2025, 10:24:26 AMApr 9
to Android CameraX Discussion Group, aubrey....@gc.com
Hi Aubrey,

CameraX currently uses MediaMuxer to save the video, and as I know it writes the metadata when the recording ends. If the user actively kills the app process during a recording, I don't think there's anything you can do within the same app to preserve the recording.
A possible solution would require CameraX to use a Muxer implementation that can write metadata in advance. If you do require it for your use cases, consider creating a feature request at issue tracker.

Thanks,
Leo

 


aubrey....@gc.com 在 2025年4月9日 星期三凌晨3:23:58 [UTC+8] 的信中寫道:

Tobias Tharaldsen

unread,
Apr 9, 2025, 10:52:24 AMApr 9
to Android CameraX Discussion Group, leoh...@google.com, aubrey....@gc.com
I tried adding a feature request for it over 2 years ago, please upvote it if you find it important or appealing:


Regarding the problem I found a way to fix corrupt videos created by CameraX inside the app, but it was a bit hacky.
It was done by adding untrunc as a ".so" file, and also somehow have a sample video that is not corrupt which have been recorded with the same video/audio-specs that the corrupt video also used.

I simply tried this with a predefined and already created sample video file, however in a real life scenario I have been going through ideas of how to get a sample for each video, and my current best idea is to just record a sample for a couple of seconds as an "initialize camera" step when camera-screen is opened.
As i said it's a bit hacky, and a feature in CameraX that could help us solve corrupt video-files in a better way would be the best.

Thanks,
Tobias

Scott Nien

unread,
Apr 9, 2025, 11:15:18 AMApr 9
to Tobias Tharaldsen, Android CameraX Discussion Group, leoh...@google.com, aubrey....@gc.com
Thanks for letting us know the importance of this issue. I've just raised the priority to P2 and would consider it in our next quarter planning. 

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/e0c7b033-5c9f-40b3-a074-013f07f4fb40n%40android.com.
Reply all
Reply to author
Forward
0 new messages