Please post source code showing how to use setmeta.
I think I figured it out after looking at in_mp4.c: Run MP4MetadataDelete() before setting any metadata. This means that one should open the file, read the metadata, close it, open it, write it, and then close it. Rather complex, I'd say
#include <stdio.h>
#include <mp4.h>
int main(int argc, char *argv[])
{
if (argc == 2) {
MP4FileHandle f = MP4Read(argv[1], 0);
char *album;
if (!f) {
fprintf(stderr, "Unable to open MP4 file %s\n", argv[1]);
return -1;
}
if (MP4GetMetadataAlbum(f, &album)) {
printf("album: %s\n", album);
free(album);
}
if(!MP4Close(f))
printf("failed to close MP4 file\n");
} else if (argc == 3) {
MP4FileHandle f = MP4Modify(argv[1], 0, 0);
if (!f) {
fprintf(stderr, "Unable to open MP4 file %s\n", argv[1]);
return -1;
}
MP4MetadataDelete(f);
if (!MP4SetMetadataAlbum(f, argv[2]))
printf("failed to set album\n");
if(!MP4Close(f))
printf("failed to close MP4 file\n");
} else {
fprintf(stderr, "Usage: %s <song> [album]\n", argv[0]);
return -1;
}
MP4Optimize(argv[1], NULL, 0);
return 0;
}