Add APE-Tag support for formats like WavPack and Musepack
Subj
WavPack is currently only supported when muxed in a Matroska file (not sure whether MP4 supports WavPack).
I did not find any useful information about that audio format. Only http://www.wavpack.com/397/wavpack_doc.htm which doesn't contain a specification of the file format.
Regarding tags, the documentation states:
WavPack provides limited support for tags. Although it will not create the tags, it will allow you to use another program to append any kind of tag to the end of the .WV file (and the .WVC file, if desired). During decompression, WvUnpack will discard the tag so as not to corrupt the .WAV file. Additionally, if the tag is an ID3v1 tag or an APEv2 tag, the Winamp plugin will display the full artist and title in the playlist and additional items in the info dialog.
So adding an ID3v1 tag should be unproblematic. This is already possible with the tag editor if you ignore the warning that the format is unsupported or use the CLI options --treat-unknown-as-mp3 --id3v1-usage always --id3v2-usage never. Maybe I can let the editor know that WavPack officially allows ID3v1 and use it by default in that case.
Not sure whether that statement means that WavPack itself really doesn't provide any tagging by itself. Even if it would, implementing support for it is not very high on my priority list. I'll keep this issue open as it is a valid feature request, of course.
Note that from the developer view this issue actually belongs to the tagparser repository and it maybe makes sense to implement it on top of the v7 branch.
After reading https://wiki.multimedia.cx/index.php/WavPack I really don't think there's much tagging support provided by WavPack. However, the utility wvtag seems to use APEv2 tags. This is currently not supported by this tag editor.
Adding ID3 tags seems possible as well. An ID3v1 tag is recognized by VLC player and MPV. ID3v2 can at least be skipped, MPV even shows it correctly.
Since ID3 tags are already supported, I made the tag editor treat WavPack files as MP3 files so it adds ID3 tags according to the specified usage (https://github.com/Martchus/tagparser/commit/cdccc247c6fed2c4e2ca4215d37e82746f0345cd). At least adding ID3v1 tags this way should be safe.
I change the title of the issue accordingly.
I can confirm that TagEditor doesn't read ID3v2/APEv2 tags from wavpack-files. So by supporting it, I mean not only writing tags but also reading them.
It should read ID3v2 - independently of the file format. I've just tested that with a version even before the change.
If a file has an ID3v2 tag at the beginning, it is recognized:
tageditor get -f luckynight.wv
Tag information for "luckynight.wv":
- File has no (supported) tag information.
tageditor set title=testtitle album=testalbum --treat-unknown-as-mp3 --id3v1-usage never --id3v2-usage always -f luckynight.wv
Setting tag information for "luckynight.wv" ...
- [100%] Updating ID3v2 tags ...
- [100%] Preparing streams for rewriting ...
- [100%] Writing ID3v2 tag ...
- [100%] Writing frames ...
- Changes have been applied.
tageditor get -f luckynight.wv
Tag information for "luckynight.wv":
- ID3v2 tag (version 2.3.0)
Title testtitle
Album testalbum
APEv2 (or v1) is not supported of course (neither reading nor writing).
Spec is here:
http://github.com/dbry/WavPack/blob/master/doc/WavPack5FileFormat.pdf
Here are my test results with FFmpeg:
- muxer: mp4, encoder: wavpack, result: bad
- muxer: matroska, encoder: wavpack, metadata: global, result: good
- muxer: matroska, encoder: wavpack, metadata: stream, result: good
- muxer: wv, encoder: wavpack, metadata: global, result: good
- muxer: wv, encoder: wavpack, metadata: stream, result: bad
So:
- WavPack doesnt work with MP4 at all
- WavPack metadata can be stored at the global level, either with the WavPack muxer or MKV muxer
- WavPack metadata can only be stored at the stream level with MKV
As far as I know MP4 is primarily designed to work with MPEG formats. So 1. is not really surprising.
Note that the fact FFmpeg can mux something does not mean it is standardized or well supported. For example, FFmpeg is able to mux Vorbis into MP4. However, this is not standard and not supported by some players (which support MP4 and Vorbis in general - just not in combination).
The tag editor should also be able to handle WavPack metadata when it is muxed into Matroska. It is possible to use targets to store tags at stream level, too. I have to admit that specifying targets is not really convenient, though.
And thanks for pointing to the documentation. So yes, this boils down to supporting APEv2 tags.