moov atom not found - Mov repair help

Questions and answers on how to get the most out of FFAStrans
Post Reply
jhora
Posts: 3
Joined: Sun Dec 01, 2024 8:01 pm

moov atom not found - Mov repair help

Post by jhora »

Hi to all
I already set a FFAStrans transcoding setup with success. Works great. Few days ago, FFAStrans caught a MOV(SHQ2) without moov atom.

validate: moov atom not found

Already tried fews tricks with ffmpeg, untrunc, atomicParsley, without any success.

ffprobe results:

ffprobe -v trace bad.mov
ffprobe version 3.4.1 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[NULL @ 00000267921e8340] Opening 'bad.mov' for reading
[file @ 00000267921e8b40] Setting default whitelist 'file,crypto'
Probing mov,mp4,m4a,3gp,3g2,mj2 score:100 size:2048
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] type:'ftyp' parent:'root' sz: 20 8 122214088704
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] ISO: File Type Major Brand: qt
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] type:'wide' parent:'root' sz: 8 28 122214088704
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] type:'mdat' parent:'root' sz: 0 36 122214088704
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] type:'ftyp' parent:'root' sz: 20 8 122214088704
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] ISO: File Type Major Brand: qt
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] type:'wide' parent:'root' sz: 8 28 122214088704
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] type:'mdat' parent:'root' sz: 0 36 122214088704
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000267921e8340] moov atom not found
[AVIOContext @ 00000267921e9920] Statistics: 65536 bytes read, 3 seeks
bad.mov: Invalid data found when processing input


I even tried to change de HExa head of the file.
Any sugestions?

best

jh
emcodem
Posts: 1812
Joined: Wed Sep 19, 2018 8:11 am

Re: moov atom not found - Mov repair help

Post by emcodem »

Edit: oh, after writing this, i see untrunc dont work? ... in this case it will become really really hard to fix i guess :D

this normally means that you face a truncated mov/mp4 file. As these container formats usually store all needed metadata that we need to decode it at the END of the file but you just don't have the END of the file, you have no chance without trickery (you can't just copy the moov of some other file, nono).
Just for cleaness, there are options to store the moov stuff at START of file but not much tools do that (ffastrans does by default) because it requires to rewrite the complete file once the recording has finished because only then we know where all the frames are and can put the index into the front of the file instead of the end. In this case, you find some moov entry in the hex editor at start of file and the end looks truncated but it is not.

If you compare a working mov file of the same format with this broken one in hex editor and you scroll to bottom, in the last few tens of bytes you usually find a byte sequence that says "moov" for working files while with truncated files, we usually just see garbage binary data at the end of the file.

Fixing such a file usually involves that you find some tool that can fix it (beware this is the stuff that usually comes with malware or bloatware).
Under normal circumstances such files can be restored by supplying a "working" sample file that has exactly the same video, audio configuration.

If you have a working version of the exact same filetype, you can proceed your search for tools. Because the search for free windows GUI tools is tedious (not sure if there are any), i can recommend you to go to a linux box (i just use Ubuntu Linux inside windows using WSL) and use "untrunc" which seems to be the number one open source tools for this kind of stuff.

I just tried and it worked like this:

Code: Select all

sudo apt update
sudo apt install snapd
sudo snap install untrunc-anthwlock --edge
Execute the file repair with a good and bad file sample located in c:\temp:

Code: Select all

untrunc-anthwlock -s /mnt/c/temp/good.mp4 /mnt/c/temp/bad.mp4
https://snapcraft.io/install/untrunc-an ... tu#install

in worst case, you can share a good and bad file (use PM if you like) for investigation
emcodem, wrapping since 2009 you got the rhyme?
Post Reply