FFmpeg, how to embed cover art (image) to .m4a

Yaroslav picture Yaroslav · Jul 23, 2013 · Viewed 18.2k times · Source

Is there any way to embed cover art to m4a files?

This one works well for mp3 but doesn't work for m4a

ffmpeg -i tests/in.m4a -i cover.jpg -map 0:0 -map 1:0 -acodec copy \
  -id3v2_version 3 tests/out.m4a

Answer

Meow picture Meow · Nov 25, 2014

mp4art from mp4v2 can also do this:

mp4art --add cover.jpg track.m4a

I tried mp4art, after adding the cover, the information from FFmpeg is like this:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fce82011400] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '01 - Welcome To New York.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: isomiso2
    title           : Welcome To New York
    artist          : Taylor Swift
    album           : 1989 (Deluxe)
    date            : 2014
    encoder         : Lavf55.48.100
    genre           : Country & Folk
    track           : 1
    disc            : 1
  Duration: 00:03:32.65, start: 0.046444, bitrate: 250 kb/s
    Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 238 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:1: Video: mjpeg, yuvj444p(pc, bt470bg), 1400x1400 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
Input #1, image2, from 'Album Cover.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: mjpeg, yuvj444p(pc, bt470bg), 1400x1400 [SAR 72:72 DAR 1:1], 25 tbr, 25 tbn, 25 tbc

It seems that 1 file has 2 input formats (1 m4a, 1 image2), I think ffmpeg should be able to do the same thing by itself instead of using a separate tool to add cover image, but I haven't figure out how.