Preserve metadata when converting .opus audio with embedded covers

2

Normally, when I run ffmpeg -i "$name.$oldext" "$name.ogg", where oldext is any of .opus, .m4a, or .flac, all metadata is preserved. However, I've just found that in the specific case where the initial file is a .opus with an embedded cover image, no metadata is present on the resulting .ogg. Converting to .flac is the same. Converting to .mp3 maintains the embedded cover but no other metadata.

What can I do to keep the metadata in this situation? Alternately, is there a simple script to copy metadata from one file to another in bulk. Many one-to-one copies, that is, not a one-to-many copy (I already can do that).

Current output of command:

ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=
/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --dis
able-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth 
--enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio
 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --
enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enab
le-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-l
ibtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265
 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libie
c61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=harden
ed --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-
shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enab
le-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --en
able-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enab
le-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-li
brtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libss
h --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --en
able-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --
enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-version3 --disable-do
c --disable-programs --disable-avdevice --disable-avfilter --disable-avformat --disable-avresample --disable-postproc
 --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwben
c
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[ogg @ 0x7e90a0] 1 bytes of comment header remain
[mjpeg @ 0x7eb020] Changeing bps to 8
Input #0, ogg, from '148 - Mewmore _ 'Zelda's Lullaby' (Remix) from The Legend of Zelda - Breath of the Wild.opus':
  Duration: 00:02:50.87, start: 0.000000, bitrate: 153 kb/s
    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      TITLE           : 'Zelda's Lullaby' (Remix) from The Legend of Zelda - Breath of the Wild
      ARTIST          : Mewmore
      album_artist    : Mewmore
      ALBUM           : Mewmore Remixes
      track           : 148
      GENRE           : Zelda Remixes
    Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
      title           : 00001 - Mewmore _ 'Zelda's Lullaby' (Remix) from The Legend of Zelda - Breath of the Wild.jpg
[swscaler @ 0x7f9c60] deprecated pixel format used, make sure you did set range correctly
[ogg @ 0x816980] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
Output #0, ogg, to '148 - Mewmore _ 'Zelda's Lullaby' (Remix) from The Legend of Zelda - Breath of the Wild.ogg':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: theora (libtheora), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tbc
    Metadata:
      DESCRIPTION     : Cover (front)
      title           : 00001 - Mewmore _ 'Zelda's Lullaby' (Remix) from The Legend of Zelda - Breath of the Wild.jpg
      encoder         : Lavc56.60.100 libtheora
    Stream #0:1: Audio: vorbis (libvorbis), 48000 Hz, stereo, fltp
    Metadata:
      TITLE           : 'Zelda's Lullaby' (Remix) from The Legend of Zelda - Breath of the Wild
      ARTIST          : Mewmore
      ALBUMARTIST     : Mewmore
      ALBUM           : Mewmore Remixes
      TRACKNUMBER     : 148
      GENRE           : Zelda Remixes
      encoder         : Lavc56.60.100 libvorbis
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg (native) -> theora (libtheora))
  Stream #0:0 -> #0:1 (opus (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
[libvorbis @ 0x85cb60] Queue input is backward in time
    Last message repeated 1 times
frame=    1 fps=0.0 q=-0.0 size=       8kB time=00:00:22.54 bitrate=   2.7kbits/s    ^M[libvorbis @ 0x85cb60] Queue input is backward in time
frame=    1 fps=1.0 q=-0.0 size=       8kB time=00:00:45.99 bitrate=   1.3kbits/s    ^M[libvorbis @ 0x85cb60] Queue input is backward in time
    Last message repeated 4 times
frame=    1 fps=0.7 q=-0.0 size=       8kB time=00:01:09.31 bitrate=   0.9kbits/s    ^M[libvorbis @ 0x85cb60] Queue input is backward in time
    Last message repeated 3 times
frame=    1 fps=0.5 q=-0.0 size=       8kB time=00:01:32.72 bitrate=   0.7kbits/s    ^M[libvorbis @ 0x85cb60] Queue input is backward in time
    Last message repeated 2 times
frame=    1 fps=0.4 q=-0.0 size=       8kB time=00:01:56.22 bitrate=   0.5kbits/s    ^M[libvorbis @ 0x85cb60] Queue input is backward in time
    Last message repeated 3 times
frame=    1 fps=0.3 q=-0.0 size=       8kB time=00:02:19.43 bitrate=   0.4kbits/s    ^M[libvorbis @ 0x85cb60] Queue input is backward in time
    Last message repeated 1 times
frame=    1 fps=0.3 q=-0.0 size=       8kB time=00:02:42.63 bitrate=   0.4kbits/s    ^Mframe=    1 fps=0.3 q=-0.0 Lsize=    2385kB time=00:02:50.84 bitrate= 114.4kbits/s    
video:5kB audio:2351kB subtitle:0kB other streams:0kB global headers:7kB muxing overhead: 1.256185%

Changing the command to ffmpeg -i "$name.$oldext" -map-metadata 0 "$name.ogg" made no difference.

Side note I just noticed - according to the default thumbnails, the result is a video file (the original was audio). Attempts to listen in a music-only player failed. If I route it via .flac the resulting .ogg is audio.

David Heyman

Posted 2017-07-30T18:58:01.047

Reputation: 137

Show the full console output of the command. – Gyan – 2017-07-30T19:33:31.323

@Mulvya Added it. – David Heyman – 2017-07-30T19:51:28.600

Does -map_metadata 0 help? – slhck – 2017-08-01T08:36:46.547

@slhck Nope, no difference. – David Heyman – 2017-08-02T01:37:34.260

Provide a sample input file if you can. Also try a recent ffmpeg: yours is ancient.

– llogan – 2017-08-02T04:15:50.523

@LordNeckbeard apt says I've got the most recent, though I do see that that link shows more recent versions. I'm uncertain how to install from there without breaking the package-managed one. Or am I to manually find a new copy to update it whenever the need arises? – David Heyman – 2017-08-04T01:07:54.197

The link I provided will give you a recent ffmpeg binary that you can extract and just run. It won't interfere with the system or repo ffmpeg. Navigate to the directory containing it and run ./ffmpeg -i ..., or provide the full path to it as in ~/Downloads/ffmpeg/ffmpeg -i .... Or put it in a directory named bin in your home directory and then re-login–it will then be in your PATH and will run the new ffmpeg from any current directory. – llogan – 2017-08-04T16:45:33.467

No answers