How to use ffmpeg to add metadata to an AAC file without reencoding?
The goal was to produce an audio-only file from a video file without re-encoding and to introduce metadata recognizable by media players. The environment is Debian GNU/Linux.
I'd like to thank @bootload for putting me on the right track to finding an answer.
ffmpeg does not appear to support adding metadata tags to .AAC output files, however, here are two possible workarounds.
- The command line utilities id3 and id3v2 (available from the standard repositories) can apply id3 tags to a .aac audio file. Nautilus recognized both v1 and v2 tag styles so either should work. The same tags were recognized by the Banshee media player.
id3v2 -t "My Title" audio.aac
- ffmpeg can add metadata to an MP4 container, but an .mp4 extension in Nautilus will appear as a video file. Apple Inc. uses non-standard extensions to the MP4 container to distinguish video files (.m4v) from audio files (.m4a). These extensions are recognized under Debian by Nautilus and by ffmpeg. So,
ffmpeg -i video.mp4 -vn -acodec copy -metadata title="My Title" audio.m4a
will produce an audio-only file recognized by Nautilus, and ffmpeg can safely add metadata to the container.
What is the intended hardware? Is it for an Apple iP* device? If so try http://atomicparsley.sourceforge.net/ Otherwise try http://ffmpeg.org/ffmpeg.html#Examples using the "UTF-8-encoded INI" mex/demux method. (Extract the metadata as utf8 file & modify & re-insert).
MP4Box (part of the "gpac" package) envelopes AAC files with MP4 containers without altering the original data. Metadata can then be added using just about any piece of tagging software:
MP4Box -add old.aac new.mp4