quodlibet / mutagen

Python module for handling audio metadata

Home Page:https://mutagen.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Writing Library Tag

Abhi5033 opened this issue · comments

This maybe not actually an issue

After muxing a flac file using ffmpeg, I'm trying to add metadata using Mutagen. Post processing in mutagen, the file is still showing Writing Library as ffmpeg in the mediainfo instead of Mutagen.

What I want
image

What I'm getting
image

I'm trying below code

def add_metadata_to_flac(file_path, metadata):
    audio = FLAC(file_path)
    audio.clear()
    with open("cover.jpg", "rb") as f:
        image = f.read()
    picture = mutagen.flac.Picture()
    picture.type = 3
    picture.data = image
    audio.add_picture(picture)

    for key, value in metadata.items():
        audio[key] = str(value)
    audio.save()

Can someone please help me? I don't want ffmpeg to be displayed as writing library

Indeed, currently Mutagen does not update the vendor string on the vorbis comments, it just sets it when there is no Vorbis comment block yet in the file and mutagen creates a new one. See https://github.com/quodlibet/mutagen/blob/main/mutagen/_vorbis.py#L73

You could set it in your code, though. I think the following should work:

audio.tags.vendor = "Mutagen " + mutagen.version_string

Should mutagen update it by default every time it writes? Probably, I'm not sure. I personally would say yes, but some users might want to preserve the current behavior.

I think it definitely should update it when calling VComment.clear.

Indeed, currently Mutagen does not update the vendor string on the vorbis comments, it just sets it when there is no Vorbis comment block yet in the file and mutagen creates a new one. See https://github.com/quodlibet/mutagen/blob/main/mutagen/_vorbis.py#L73

You could set it in your code, though. I think the following should work:

audio.tags.vendor = "Mutagen " + mutagen.version_string

Should mutagen update it by default every time it writes? Probably, I'm not sure. I personally would say yes, but some users might want to preserve the current behavior.

I think it definitely should update it when calling VComment.clear.

Thank you So Much Sir. It worked.