Add album art cover to an OGG/opus file from the command line

4

1

I managed to add an album art cover to an OGG/opus file with Kid3 - Audio Tagger but I'd like to do it via the command line on all the files of an album.

I tried with ffmpeg but it did not work :

$ ffmpeg -i myMP3File.opus -i Back_Cover-SMALLER.jpg -map 0:0 -map 1:0 -c copy -metadata:s:v title="Back_Cover-SMALLER.jpg" -metadata:s:v comment="Cover (back)" out.opus
Input #0, ogg, from 'myMP3File.opus':
  Duration: 00:03:04.25, start: 0.000000, bitrate: 98 kb/s
    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      ALBUM           : Toto
      track           : 1/14
Input #1, image2, from 'Back_Cover-SMALLER.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 27608 kb/s
    Stream #1:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 768x768 [SAR 100:100 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
File 'out.opus' already exists. Overwrite ? [y/N] y
[opus @ 0x565557805300] Unsupported codec id in stream 1
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
    Last message repeated 1 times

Does anyone know another way ?

SebMa

Posted 2018-12-16T23:57:43.187

Reputation: 599

Answers

1

I suggest using a Matroska wrapper around the opus. It won't re-encode the opus.

This worked for me:

mkvmerge -o "Susheela Raman - Tanpa Nama.mkv"   audio.opus  --attach-file cover.jpg

Matroska also allows you to include different size cover art (square, portrait, landscape). https://www.matroska.org/technical/cover_art/index.html

hackerb9

Posted 2018-12-16T23:57:43.187

Reputation: 579