13
4
I'm using ffmpeg to extract just the audio stream from a video file:
ffmpeg -i video.mp4 -vn -acodec copy audio.aac
This produces a clean audio file but without any metadata.
To add metadata, ffmpeg has a command line option:
ffmpeg -i video.mp4 -vn -acodec copy -metadata title="My Title" audio.aac
This runs without error, but when the output file is checked with ffprobe, it has no metadata tags at all.
If the output container is changed to mp4, the metadata can be set and appears in the output file:
ffmpeg -i video.mp4 -vn -acodec copy -metadata title="My Title" audio.mp4
Here's the interesting bit; if I use Banshee to edit the metadata of an existing .aac file, then use ffmpeg to process the file the same way, the original metadata is copied successfully to the new .aac file.
ffmpeg -i metadata.aac -vn -acodec copy audio.aac
but, attempts to change the metadata have no effect:
ffmpeg -i metadata.aac -vn -acodec copy -metadata title="My Title" audio.aac
So it seems the .aac container can hold metadata and ffmpeg can copy it from input to output, but can't alter it when the copy codec is used.
Does anyone know of a way to get ffmpeg to alter the metadata in an aac container without reencoding?
Alternately, is there another generic tool I could be using to set the metadata after the file has been processed?
Much thanks. Chris.
The environment is Debian GNU/Linux. – Chris C. – 2011-10-26T12:58:28.463
The ffmpeg documentation is not clear on how to use the metadata muxer/demuxer, though the document link shows the resulting file format. Can you provide a command line example of how this would be done? Thanks. – Chris C. – 2011-10-26T13:00:29.897
@ChrisC doesn't look good. Without wading through the aac & ffmpeg specs to verify this it looks like the metadata honoured by ffmpeg is listed here ~ http://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata#Basic_Usage and acc isn't supported. Using the cli for other formats you follow the pattern 'ffmpeg -i track05.wav -metadata title="Track #5" -metadata author="Unknown Artist" -acodec alac -y track05.m4a for example. The generalised pattern is ffmpeg -i <SOURCE> -metadata key="value" <SOURCE>. This is exactly the process you followed :(
– bootload – 2011-10-27T01:07:54.507Lets get very specific. What is the format of the metadata you want to encode to? Are we talking ID3? What format are you going to finally work with? – bootload – 2011-10-27T02:49:56.793
I took a look around to see what AAC supports. There may not be an official format, but within Debian ID3V1 and ID3V2 both seem to work. Banshee appears to be putting ID3V2 tags on when using its editor. – Chris C. – 2011-10-28T22:33:46.150