I'm using the tool 'FFmpeg' to do this. According to the FFmpeg documentation, the syntax is quite straightforward:
Code: Select all
-metadata key=value
Here's an example:
Code: Select all
ffmpeg -i input.avi -vcodec copy -acodec copy -metadata title="The Title" -metadata=encoded_by="Hans Stahl" output.avi
Unfortunately, the current FFmpeg implementation cannot simply update the header data of an existing AVI file. It must read/write the whole file at least once, in order to embed the metadata.
== Available metadata fields?
According to FFmpeg's AVI-format source code, FFmpeg’s AVI muxer honors the following metadata keys and maps them to these FourCCs in the file header:
Code: Select all
const AVMetadataConv ff_avi_metadata_conv[] = {
{ "IART", "artist" },
{ "ICMT", "comment" },
{ "ICOP", "copyright" },
{ "ICRD", "date" },
{ "IGNR", "genre" },
{ "ILNG", "language" },
{ "INAM", "title" },
{ "IPRD", "album" },
{ "IPRT", "track" },
{ "ISFT", "encoder" },
{ "ITCH", "encoded_by"},
{ "strn", "title" },
{ 0 },
};
The above list only contains the metadata fields mapped to a human readable alias. If I read FFmpeg's AVI-format source code correctly, it can handle more fields:
Code: Select all
const char ff_avi_tags[][5] = {
"IARL", "IART", "ICMS", "ICMT", "ICOP", "ICRD", "ICRP", "IDIM", "IDPI",
"IENG", "IGNR", "IKEY", "ILGT", "ILNG", "IMED", "INAM", "IPLT", "IPRD",
"IPRT", "ISBJ", "ISFT", "ISHP", "ISRC", "ISRF", "ITCH",
{0}
};
Code: Select all
ATTRIBUTE_NAMES = {
'Archival Location' => 'IARL',
'Artist' => 'IART',
'Author' => 'IART',
'Comissioned' => 'ICSM',
'Comment' => 'ICMT',
'Description' => 'ICMT',
'Copyright' => 'ICOP',
'Date Created' => 'ICRD',
'Cropped' => 'ICRP',
'Dimensions' => 'IDIM',
'Dots Per Inch' => 'IDPI',
'Engineer' => 'IENG',
'Genre' => 'IGNR',
'Keywords' => 'IKEY',
'Lightness' => 'ILGT',
'Medium' => 'IMED',
'Title' => 'INAM',
'Name' => 'INAM',
'Number of Colors' => 'IPLT',
'Product' => 'IPRD',
'Subject' => 'ISBJ',
'Software' => 'ISFT',
'Encoding Application' => 'ISFT',
'Sharpness' => 'ISHP',
'Source' => 'ISRC',
'Source Form' => 'ISRF',
'Technician' => 'ITCH'
}
Additional references: