0

I use Linux (Kubuntu 16.04), and I have some .MP4 files with audio tracks, which I want to extract, save as .AAC/.M4A files and tag.

Now, I've been doing the extraction using

MP4Box -raw $track_index my_file.mp4

where the track index can be 0, 1, 2 etc. This works, since I can play the result in various media players... but - does it, really?

Someone who looked at my files told me:

the "ftyp" field is missing from the head of the file, which would identify it as an MPEG 4 container. There are also no "mdat" fields, which would indicate individual chunks of data inside an MPEG 4 container.

and this makes it difficult for certain apps to work with my extracted files. Specifically, tagging apps... which refuse to write tags for it.

What can I do to get properly-structures, taggable M4A/AAC files? (I'm looking for a command-line solution naturally.)

1 Answer 1

1

Don't use 'raw'. Use 'single'. Then change the extension to .m4a.

From MP4Box documentation:

-single TrackID : extracts track in a new MP4 with a single track.

I took a random MP4 and extracted the audio using these two options. Then I used Media Info to inspect them. The raw option output had a file format of ADTS, whereas the the single option output's was MPEG-4.

It seems that -raw produces a transport stream file, which doesn't support metadata such as tags. When I use the app Tagger, it does not even see the -raw output file, whereas it allows me to open the -single output and edit tags for it.

https://gpac.wp.mines-telecom.fr/mp4box/mp4box-documentation/

5
  • +1, but would you happen to know how I could wrap the transport stream file in a "normal" audio-stream-only MP4?
    – einpoklum
    Dec 9, 2016 at 17:05
  • I don't think transport streams work that way. But -single automatically creates the file type you want. It's not a re-encode. From what I gather, what you're suggesting would take a single-step process and turn it into a multi-step one. I would change the extension so that it is clear to other software that it is specifically an audio file.
    – Mockman
    Dec 9, 2016 at 17:19
  • I meant, assuming you've extracted the transport strea file and no longer have the original MP4...
    – einpoklum
    Dec 9, 2016 at 17:52
  • Ahh… let me think about that for a bit. But when I was looking at mp4box, I thought I saw an option to create a new container file. So it would probably be something along the lines of create new container with this audio stream.
    – Mockman
    Dec 9, 2016 at 18:14
  • Try this, you could probably use either 'm4a' or 'mp4' as the outputfile extension… mp4box -add _inputfile_ _outputfile_
    – Mockman
    Dec 9, 2016 at 18:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .