Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing Library Tag #644

Open
Abhi5033 opened this issue Mar 14, 2024 · 2 comments
Open

Writing Library Tag #644

Abhi5033 opened this issue Mar 14, 2024 · 2 comments

Comments

@Abhi5033
Copy link

Abhi5033 commented Mar 14, 2024

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

@phw
Copy link
Collaborator

phw commented Mar 14, 2024

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.

@Abhi5033
Copy link
Author

Abhi5033 commented Mar 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants