ExifTool Forum

General => Metadata => Topic started by: foremtehan on February 09, 2023, 07:20:27 AM

Title: How to add Cover Art to an m4a file ?
Post by: foremtehan on February 09, 2023, 07:20:27 AM
I want to add music cover to an m4a file, I tried:

exiftool -CoverArt=/path/to/cover.jpg file.m4a

But looks like it only add cover as string, How can i embed this cover as binary ?

Thanks.
Title: Re: How to add Cover Art to an m4a file ?
Post by: Phil Harvey on February 09, 2023, 09:19:53 AM
Try this:

exiftool "-CoverArt<=/path/to/cover.jpg" file.m4a

- Phil
Title: Re: How to add Cover Art to an m4a file ?
Post by: foremtehan on February 09, 2023, 09:26:19 AM
Thanks!
Title: Re: How to add Cover Art to an m4a file ?
Post by: foremtehan on February 09, 2023, 09:32:00 AM
Just one little thing, It has no description i was expecting an "Front Album Cover"
Title: Re: How to add Cover Art to an m4a file ?
Post by: Phil Harvey on February 09, 2023, 10:05:58 AM
The tag is named "CoverArt" in ExifTool.  I'm not sure where you expected a different description.

- Phil
Title: Re: How to add Cover Art to an m4a file ?
Post by: foremtehan on February 09, 2023, 11:02:53 AM
By the "description" i meant an title or description on the image itslef

this is an mp3 cover tag with description:

https://i.imgur.com/0v2j0CD.png

this is from above command:

https://i.imgur.com/80WBvoo.png
Title: Re: How to add Cover Art to an m4a file ?
Post by: Phil Harvey on February 09, 2023, 11:08:14 AM
MP3 and M4A are two different beasts.

If you can find an M4A with a description like this, send it to me and I'll take a look to see how it is stored.  My email is philharvey66 at gmail.com

- Phil
Title: Re: How to add Cover Art to an m4a file ?
Post by: StarGeek on February 09, 2023, 11:11:42 AM
I added a cover to a file using Mp3Tag and it an option to set a cover as "Front Cover".  I tried looking for the location of that info with ffprobe and ffmpeg, but neither of them listed it.

It has to be somewhere, as when I reload the file into Mp3Tag, the file shows shows the image as the front cover.  The second image I had added to the file and set to back cover did not save that value and showed up as other.  So the back image value wasn't saved.

Phil, sending you the file I created with Mp3tag.
Title: Re: How to add Cover Art to an m4a file ?
Post by: Phil Harvey on February 09, 2023, 12:54:37 PM
Thanks StarGeek.

I definitely can't see any text that gives the name of the cover art in that file, but ID3, ASF and FLAC metadata use this lookup for the cover art type:

            0 => 'Other',
            1 => '32x32 PNG Icon',
            2 => 'Other Icon',
            3 => 'Front Cover',
            4 => 'Back Cover',
            5 => 'Leaflet',
            6 => 'Media',
            7 => 'Lead Artist',
            8 => 'Artist',
            9 => 'Conductor',
            10 => 'Band',
            11 => 'Composer',
            12 => 'Lyricist',
            13 => 'Recording Studio or Location',
            14 => 'Recording Session',
            15 => 'Performance',
            16 => 'Capture from Movie or Video',
            17 => 'Bright(ly) Colored Fish',
            18 => 'Illustration',
            19 => 'Band Logo',
            20 => 'Publisher Logo',

So all we need is a "3" stored somewhere for Front Cover.  But I don't see that anywhere either.  Both images are stored in the same QuickTime covr atom, and I see nothing different in the headers.  I'm wondering if Mp3Tag just marks the first image as Front Cover, and all others as Other?

- Phil
Title: Re: How to add Cover Art to an m4a file ?
Post by: StarGeek on February 09, 2023, 01:10:22 PM
Quote from: Phil Harvey on February 09, 2023, 12:54:37 PMI'm wondering if Mp3Tag just marks the first image as Front Cover, and all others as Other?

Yes, this appears to be the case.  I tried setting the front cover to other, closed down Mp3Tag and reopened and the first image was front cover again.

foremtehan, do you have an m4a file that shows a "front cover" and maybe "back cover"?  It may be that it just isn't an option in this case.
Title: Re: How to add Cover Art to an m4a file ?
Post by: Phil Harvey on February 09, 2023, 01:26:32 PM
You could presumably use ID3 on an M4A file, and that would give you this information, but ID3 sux and ExifTool doesn't write it.

- Phil