AVAssertExportSession non deterministic for m4a files

Hello,

I encountered an issue with AVAssertExportSession.

My iOS app uses an AVAssertExportSession with AVAssetExportPresetPassthrough to export audio files from the media library, and use it later.

I noticed that if I export the same m4a file several times, the resulting file is never the same. The exported file sounds exactly the same, but there are a few different bytes between the exported files.
This does not seem to be the case for other formats (wav and aiff for example).

This is actually an issue for me for several reasons.

Do you know if this is an expected behaviour or a bug?

Is there a way to obtain the same output every time in the case of m4a files?

Thank you for your help 🙏

Replies

The mp4 file format has got a creation data and modified date field that are set to the date of when it was created, so those will be different. You should check if the actual audio data is the same. Or you can use some app like l-smash to dump the structure of the mp4 file and compare the actual differences.

That makes sense!

Thank you for the insight, I guess I have to parse the m4a format then 😉