Opened 5 years ago

Last modified 20 months ago

#7579 open enhancement

ID3 metadata not written in WAV

Reported by: slhck Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: wav metadata
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

ID3 metadata embedded in a WAV file is not copied over to the output despite specifying -map_metadata 0.

How to reproduce:

➜ ffmpeg -i 04\ -\ Mr\ Unconductive\ Frying\ Pan\ Handle\ Man\ -\ A\ Beautiful\ Ballada\ Cover\ -\ giovanigoulart.wav -c copy -map_metadata 0 -t 1 test.wav
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.10.44.4)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-librtmp --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtwolame --enable-libvidstab --enable-libwavpack --enable-libwebp --enable-libzimg --enable-libzmq --enable-opencl --enable-openssl --enable-videotoolbox --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.3.0/include/openjpeg-2.3 --enable-nonfree
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '04 - Mr Unconductive Frying Pan Handle Man - A Beautiful Ballada Cover - giovanigoulart.wav':
  Duration: 00:03:46.72, bitrate: 2845 kb/s
    Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 44100 Hz, stereo, flt, 2822 kb/s
File 'test.wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'test.wav':
  Metadata:
    ISFT            : Lavf58.20.100
    Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 44100 Hz, stereo, flt, 2822 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     348kB time=00:00:00.99 bitrate=2856.1kbits/s speed= 138x
video:0kB audio:348kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.031991%

The input file contains metadata:

➜ mediainfo 04\ -\ Mr\ Unconductive\ Frying\ Pan\ Handle\ Man\ -\ A\ Beautiful\ Ballada\ Cover\ -\ giovanigoulart.wav
General
Complete name                            : 04 - Mr Unconductive Frying Pan Handle Man - A Beautiful Ballada Cover - giovanigoulart.wav
Format                                   : Wave
File size                                : 76.9 MiB
Duration                                 : 3 min 46 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 2 845 kb/s
Album                                    : To The Moon Edition - BETA
Album/Performer                          : FASNASTIC
Track name                               : Mr Unconductive Frying Pan Handle Man - A Beautiful Ballada Cover
Track name/Position                      : 4
Performer                                : FASNASTIC
Genre                                    : Comedy
Recorded date                            : 2015
Copyright                                : FASNASTIC LTD
Cover                                    : Yes
Cover type                               : Cover (front)
Cover MIME                               : image/png
Comment                                  : giovanigoulart

Audio
Format                                   : PCM
Format profile                           : Float
Codec ID                                 : 3
Codec ID/Hint                            : IEEE
Duration                                 : 3 min 46 s
Bit rate mode                            : Constant
Bit rate                                 : 2 822 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Bit depth                                : 32 bits
Stream size                              : 76.3 MiB (99%)

The output file does not:

➜ mediainfo test.wav
General
Complete name                            : test.wav
Format                                   : Wave
File size                                : 348 KiB
Duration                                 : 1 s 10 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 2 823 kb/s
Writing application                      : Lavf58.20.100

Audio
Format                                   : PCM
Format profile                           : Float
Codec ID                                 : 00000003-0000-0010-8000-00AA00389B71
Codec ID/Hint                            : IEEE
Duration                                 : 1 s 10 ms
Bit rate mode                            : Constant
Bit rate                                 : 2 822 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Bit depth                                : 32 bits
Stream size                              : 348 KiB (100%)

Also reproduced with Git master.

The file has been shared by the user @FASNASTIC. I can supply the sample, but it's 80MB:

https://www.dropbox.com/s/oqtdqzpgetkvivw/04%20-%20Mr%20Unconductive%20Frying%20Pan%20Handle%20Man%20-%20A%20Beautiful%20Ballada%20Cover%20-%20giovanigoulart.wav?dl=0

The (ID3) metadata is added in the end: https://www.dropbox.com/s/aidlpcr13q4h22f/Screenshot%202018-11-28%2021.56.00.png?dl=0

Attachments (1)

test2.wav (350.1 KB ) - added by slhck 5 years ago.
Tagged WAV file

Download all attachments as: .zip

Change History (8)

comment:1 by Carl Eugen Hoyos, 5 years ago

Component: undeterminedavformat
Keywords: wav added
Priority: normalwish
Type: defectenhancement

For future tickets: Please remember to always test current FFmpeg git head, nothing else is supported here.
Depends on ticket #5700.

What's wrong with small sample files?

comment:2 by slhck, 5 years ago

Please remember to always test current FFmpeg git head

I did test with Git head as well – please see the original description. For the sake of completeness, the output:

~/Downloads/ffmpeg -i 04\ -\ Mr\ Unconductive\ Frying\ Pan\ Handle\ Man\ -\ A\ Beautiful\ Ballada\ Cover\ -\ giovanigoulart.wav -c copy -map_metadata 0 -t 1 test.wav
ffmpeg version N-92525-ge488d7b4f5-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 40.100 / 58. 40.100
  libavformat    58. 23.100 / 58. 23.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 46.100 /  7. 46.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '04 - Mr Unconductive Frying Pan Handle Man - A Beautiful Ballada Cover - giovanigoulart.wav':
  Duration: 00:03:46.72, bitrate: 2845 kb/s
    Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 44100 Hz, stereo, flt, 2822 kb/s
Output #0, wav, to 'test.wav':
  Metadata:
    ISFT            : Lavf58.23.100
    Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 44100 Hz, stereo, flt, 2822 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     348kB time=00:00:00.99 bitrate=2856.1kbits/s speed= 599x
video:0kB audio:348kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.031991%

What's wrong with small sample files?

Like I wrote, the metadata is added in the end of the file (as indicated by the hexdump), so I cannot just truncate the 80MB WAV to a short one that exhibits the same issue. Hence I supplied the original file.

As I do not know how the file was generated, I cannot produce a small sample that shows the same behavior.

I can create a file that I then tag with id3tag, but reading this, ffmpeg shows a different message ("Discarding ID3 tags because more suitable tags were found.") which implies that the tags saved by id3tag are different from the ones in the large sample file that I have:

➜ id3tag -aFoo -sBar test2.wav
+++ Artist  = Foo
+++ Song    = Bar
Tagging test2.wav: attempting v1 and v2, tagged v1 and v2

➜ ~/Downloads/ffmpeg -i test2.wav -c copy -map_metadata 0 test3.wav
ffmpeg version N-92525-ge488d7b4f5-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 40.100 / 58. 40.100
  libavformat    58. 23.100 / 58. 23.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 46.100 /  7. 46.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[wav @ 0x7fe645000800] Discarding ID3 tags because more suitable tags were found.
Input #0, wav, from 'test2.wav':
  Metadata:
    encoder         : Lavf58.23.100
  Duration: 00:00:01.01, bitrate: 2839 kb/s
    Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 44100 Hz, stereo, flt, 2822 kb/s
Output #0, wav, to 'test3.wav':
  Metadata:
    ISFT            : Lavf58.23.100
    Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 44100 Hz, stereo, flt, 2822 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     348kB time=00:00:00.99 bitrate=2856.1kbits/s speed=1.09e+03x
video:0kB audio:348kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.031991%

➜ id3info test2.wav test3.wav

*** Tag information for test2.wav
=== TPE1 (Lead performer(s)/Soloist(s)): Foo
=== TIT2 (Title/songname/content description): Bar

*** Tag information for test3.wav

Either way they do not get written to the output.

by slhck, 5 years ago

Attachment: test2.wav added

Tagged WAV file

comment:3 by Elon Musk, 5 years ago

Do you need also cover art to be copied over?

comment:4 by slhck, 5 years ago

I think it would be the most useful if the APIC data was also carried over, yes, assuming that this is stored in a similar manner to all other ID3 data. Thanks for looking into it!

comment:5 by Elon Musk, 5 years ago

wav supports storing metadata old way via LIST/INFO (which does not support cover art) and new way (at least by some applications) via 'ID3 ' chunk. Neither are wide spread.

comment:6 by slhck, 5 years ago

It seems that the latter is more widely supported and more feature-rich. Could the ID3 chunk simply be copied over?

comment:7 by Balling, 20 months ago

Status: newopen

This is partially fixed now (before 76cb899f8ad370bdbd02bb953d4a64af988f1665), but not all metadata is copied even on HEAD of master.

Last edited 20 months ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.