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

mid3v2 not working with .opus files. #604

Open
iconoclasthero opened this issue Mar 25, 2023 · 4 comments
Open

mid3v2 not working with .opus files. #604

iconoclasthero opened this issue Mar 25, 2023 · 4 comments
Labels

Comments

@iconoclasthero
Copy link

From the README: "Mutagen is a Python module to handle audio metadata. It supports ASF, FLAC, M4A, Monkey's Audio, MP3, Musepack, Ogg Opus, Ogg FLAC, Ogg Speex, Ogg Theora, Ogg Vorbis, True Audio, WavPack, OptimFROG, and AIFF audio files."

I was expecting that the mutagen package would be able to retag the Album/TALB field of .opus files and be able to read them based on the second sentence above. What I found is that it mid3v2 doesn't modify .opus tags and mutagen-inspect does not "load and print information about an [opus] audio file and its tags:"

$ mid3v2 -A "SM (opus)" jm.opus ; mutagen-inspect jm.opus
-- jm.opus
can't sync to MPEG frame
$ mid3v2 -A "SM (opus)" jm.opus ; mediainfo jm.opus |grep -E 'Album|TALB|talb'
Album                                    : Saint Mary of the Woods

@phw
Copy link
Collaborator

phw commented Mar 26, 2023

Pretty likely your file isn't a Ogg Opus file. If this indeed contains Opus encoded audio it's pretty likely that it is Matroska Opus, but Matroska containers are not yet supported by mutagen (see #3 and #396).

If you have ffmpeg installed, can you run ffprobe [filename] on the file? If the output says something like "Input #0, matroska" then it is a matroska file and unsupported. If it says "Input #0, ogg" it's supposed to work.

@phw
Copy link
Collaborator

phw commented Apr 10, 2023

The issue got discussed on IRC and it turned out that the reason this brole was that the files got ID3 tags added to them. The command in the issue description also shows that mid3v2 was used on the Ogg Opus file, which is not supposed to be done as Ogg Opus does not use ID3 tags.

Essentially this is not a bug. mid3v2 is not supposed to support Ogg tags, it is a direct replacement for id3v2 command. But a side effect seems to have been that mid3v2 added a ID3 tag block to the file. Not sure if this is inteded or should be prevented.

See the discussion at https://chatlogs.metabrainz.org/libera/musicbrainz/2023-03-27/?msg=5152125&page=2

@iconoclasthero
Copy link
Author

iconoclasthero commented Apr 11, 2023 via email

@phw phw changed the title mutagen package not working with .opus files. mid3v2 not working with .opus files. Sep 15, 2023
@phw
Copy link
Collaborator

phw commented Mar 4, 2024

But a side effect seems to have been that mid3v2 added a ID3 tag block to the file. Not sure if this is inteded or should be prevented.

Actually I think nothing should be changed, as this is exactly the behavior the original id3v2 command also has. You can try it:

touch sometestfile
id3v2 -A "foo" sometestfile

The result is a file that only contains a ID3 block. But you can also run id3v2 on any other file you want and it will add an ID3 block to the start of the file (which will probably break it for other applications).

As mid3v2 is supposed to be a drop-in replacement for id3v2 the current behavior makes sense.

@phw phw added the notabug label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants