Samsung S10 phones produce broken MP4s without MOOV atoms

Update 2021-04: There was some discussion of a similar issue over at ffmpeg-user (full thread at nabble). It may not be the same problem, but I found it interesting that Android would produce another seemingly-unrecoverable video


I recorded the grinding out of a tree stump on my phone over the course of half an hour or so.

However, when I downloaded the video to my computer to send to the tree surgeon, I found it wouldn’t play in VLC past a certain point. That’s odd, as VLC has for more than a decade been the go-to media player as it’ll play things that others can’t make heads or tail of. Back in the day that was Windows Media Player, but that’s a digression for another time.

The only decent result I could find on searching was this:

Videos shot on the G970U1 (and I’ve tried two separate phones) are being saved in incorrectly-built .mp4 files. While playback is still possible on the phone itself, media players on other devices — across a number of Linux, Windows, and cloud players — are uniformly unable to play the videos. Player software and ffprobe report that the moov atom is missing from the files.

I believe this bug started with an update at some point in the last 9 months, but I can’t confirm that or pinpoint the exact build where things went wrong.
 
The factory-unlocked phones showing the issue are currently on the AT&T network in the US. They have the baseband version G970U1UES3DTDD , the kernel version 4.14.117-18242889 (May 14), and the June 1 security patch. The software checker reports being up to date.
 
A Samsung chat rep advised that this is a known issue but that it should have been fixed by some prior update. After I reiterated that the software appears to be current, he pasted a generic boilerplate “wipe the cache partition” message and then marked the issue as “resolved” and left. Needless to say, wiping the cache partition did not resolve the problem.
 
I also tried installing Open Camera and shooting a video on it, and I got the same failure, even on videos I recorded after manually choosing Open Camera’s h.264, HEVC, and 3GPP format options (.webm failed to record off the bat). I suppose that suggests that it’s a lower-level problem with the camera driver, but I don’t have any real knowledge of how the software stack works for shooting video.
 
Can anyone else offer any insight into what might be going on here and whether there is a solution or workaround?

(from archive.org: https://web.archive.org/web/20200804061457/https://us.community.samsung.com/t5/Galaxy-S10/S10e-video-recordings-saved-in-files-with-bad-or-missing-moov/td-p/1302649)

There were no replies. The thread is now gone. Google cache had it for a while, but even that’s gone now. Denvercoder wept!

ffmpeg couldn’t fix it up. I tried this untrunc fork: https://github.com/ponchio/untrunc (usage: untrunc -s) and got informed about a seemingly irrelevant atom:

Warning: Skipping ftyp atom: 24

Which apparently specifies ‘File type compatibility—identifies the file type and differentiates it from similar file types, such as MPEG-4 files and JPEG-2000 files’ (per https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html, see also http://atomicparsley.sourceforge.net/mpeg-4files.html)

In the end, a reasonable workaround was to upload the video file to Google Drive (or YouTube), where it plays correctly, as far as I can tell.

Tell us what's on your mind