minimp4 icon indicating copy to clipboard operation
minimp4 copied to clipboard

The program exits abnormally

Open LemonPG opened this issue 5 years ago • 2 comments

When the program exits abnormally, MP4E_close cannot be called normally, how can I repair the file?

LemonPG avatar Feb 01 '21 09:02 LemonPG

Hi)

I'm not sure. But according to doc write() and close() is allowed in signal handlers: https://man7.org/linux/man-pages/man7/signal-safety.7.html so it's theoretically possible to call MP4E_close on app abnormal termination.

If MP4E_close is not called, in default mode there almost impossible to to repair data since all frames stored in 1 mdat and without indexes frames length is unknown.

In sequential mode repair process is somewhat real since each frame resides in individual mdat and have known length. But still not simple, you need restore some meta info like codecs used and which individual mdat belongs to what track which is complex task too, but can be simple for 1 track file case.

If fragmented mode file should be decodable to last complete mdat/moof fragment.

lieff avatar Feb 01 '21 10:02 lieff

Hi)

I'm not sure. But according to doc write() and close() is allowed in signal handlers: https://man7.org/linux/man-pages/man7/signal-safety.7.html so it's theoretically possible to call MP4E_close on app abnormal termination.

If MP4E_close is not called, in default mode there almost impossible to to repair data since all frames stored in 1 mdat and without indexes frames length is unknown.

In sequential mode repair process is somewhat real since each frame resides in individual mdat and have known length. But still not simple, you need restore some meta info like codecs used and which individual mdat belongs to what track which is complex task too, but can be simple for 1 track file case.

If fragmented mode file should be decodable to last complete mdat/moof fragment.

Thank you for giving me some inspiration, I will try to fix it

LemonPG avatar Feb 02 '21 03:02 LemonPG