wave: Read metadata from RIFF INFO chunk#538
Conversation
|
Maybe interesting, there is a read/write implementation for RIFF tags in https://github.com/metabrainz/picard/blob/master/picard/formats/wav.py . I always wanted to submit this in some way to mutagen, but never was sure how to best integrate this. It maybe should work somewhat like ID3v1 is handled, where you can specify on writing ID3v2 whether you also want to write ID3v1 tags as well. |
|
I guess the implementation in picard is quite similar to what I have done, but I also have the re-mapping step to ID3. Can't say that I have full knowledge nor understanding of the inner workings of ID3 in the context of mutagen, but this should make it possible to save it in whatever version you like. The LIST chunk is/was just transparent and always passed through before and that will happen now as well. But if it's present, it will add an id3 chunk as well, if not already present. Format of that chunk depends on what is specified when saving metadata to file. |
| try: | ||
| # Value is null-terminated and supposed to be ASCII, but not everyone | ||
| # respects that and puts unicode in there anyway | ||
| value = chunk.read()[:-1].decode("utf-8") |
There was a problem hiding this comment.
utf-8 is not a safe choice either, though. foobar2k supports utf-8 in RIFF INFO. But Windows not, and will use Windows-1252 instead (or probably whatever encoding the localized version of Windows is using by default).
In the end it's a mess of course, because there is no way to indicate encoding. But maybe trying UTF-8 first and on UnicodeDecodeError retry with Windows-1252.
|
Looking forward to seeing this added, as I currently have to use a second library alongside mutagen for this support. |
Metadata seems to be all over the place with WAVE, but files converted with ffmpeg seems to not insert ID3 tags but only in the LIST/INFO chunk. So I've made an attempt implementing support for reading metadata from there and converting it to ID3 tags. Not sure if I've done it OK, so would love some feedback. One thing I'm not sure about is how to deal with is "delete". I'm currently deleting the LIST tag, but I find that to be rather destructive. Any input would be great.
See #207