2

Question

I have 2 files:

  • audio.opus (extension also possible: .opus.ogg),
  • cover.jpg.

How can I use ffmpeg to put cover.jpg as an embedded "cover" image into audio.opus?

Constraints

  • I don't want to re-encode the audio (so unfortunately, opusenc --picture seems out of scope),
  • I don't want to re-encode the image (jpeg), although that's not much of a problem,
  • I don't want to transform the image into a video (!),
  • I'd really prefer doing it with ffmpeg and not another tool,
  • I don't want to hear about mp3.

Expected result

Here is how it should look like when it's properly done:

$ opusinfo audio_with_cover.opus
Processing file "audio_with_cover.opus"...

New logical stream (#1, serial: 39a74bbb): type opus
Encoded with libopus 1.3.1
User comments section follows...
    ENCODER=opusenc from opus-tools 0.1.10
    METADATA_BLOCK_PICTURE=3|image/jpeg||1280x720x24|<45952 bytes of image data>
    ENCODER_OPTIONS=--bitrate 56
Opus stream 1:
    Pre-skip: 312
    [...]

Or seen from ffprobe:

$ ffprobe audio_with_cover.opus 
[ogg @ 0x55675650ca80] 761 bytes of comment header remain
Input #0, ogg, from 'audio_with_cover.opus':
  Duration: 00:02:25.64, start: 0.000000, bitrate: 71 kb/s
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      ENCODER         : opusenc from opus-tools 0.1.10
      ENCODER_OPTIONS : --bitrate 56
  Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 90k tbr, 90k tbn (attached pic)
    Metadata:
      comment         : Cover (front)

Not possible?

If you know it is not possible, please let me know, I will open a feature request at ffmpeg.

Totor
  • 19,302
  • 17
  • 75
  • 102
  • 1
    Open a ticket at trac.ffmpeg.org and reference this pending patch: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=7314 – Gyan Sep 21 '22 at 05:00
  • Thank you @Gyan, I [added to the already existing ticket](https://trac.ffmpeg.org/ticket/4448#comment:6) with a reference to the patch you pointed out. – Totor Sep 22 '22 at 14:42

0 Answers0