1

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.

  • Make sure all the atoms listed here are correctly updated : [MP4 - Configure time](https://stackoverflow.com/a/18552833/2057709) – VC.One Oct 14 '18 at 19:29
  • @VC.One See I think the only table that needs to be corrected is the offset ie the STCO, since the rest remain the same as the data itself nor the length of it has been changed just its position. Please correct me if I am wrong. – cluelessatmaths Oct 15 '18 at 09:08

0 Answers0