I want to create an M4A file from an MP4, I want to attempt this from scratch without using other libraries but just the raw data.
So far I am able to locate the atom moov
and parser it. And as a result I can pull the audio data from the mdat
. So then I create my own M4A file with the right ftyp
(M4A isomiso2) then add a new mdat
with just the audio data I previously recovered, finally I add the moov
with the same mvhd
, and only the audio trak
but with an updated stco
to reflect the change in offsets of the chunks of audio data (as they are just one after each other now). I am sure I am doing all of this right.
However the M4A file just plays silence. I believe it is because I have to edit more in the moov but I am not sure what - I put it into FFmpeg corruption and I got:
- "Sample rate index in program config element does not match the sample rate index configured by the container."
- "Too large remapped id is not implemented."
So as a result I think it is something to do with the stsd
atom but I am not sure how to change it.