Skip to content

MP3 strip bug #913

Closed
Closed

Description

@whatdoineed2do

Update: Fix in pr #914

There is MP3 stripping bug if you have a file with both APE and ID3v1 tag.

If you try to strip using strip(TagLib::MPEG::File::ID3v1 | TagLib::MPEG::File::APE); or calling strip(TagLib::MPEG::File::ID3v1) before strip(TagLib::MPEG::File::APE) then saving the file results in the ID3v1 untouched.

However if your file does not have APE tag then this works as expected.

Here is the code to demonstrate:

#include <iostream>
#include <taglib/mpegfile.h>

int main(int argc, char *argv[])
{
    if (argc != 3) {
        return 1;
    }
    try
    {
        TagLib::MPEG::File  f(argv[2], false);

	switch (*argv[1])
	{
            case '0':
// this is the only item that works
	      f.strip(TagLib::MPEG::File::APE);
	      f.strip(TagLib::MPEG::File::ID3v1);
	      break;

// these leave the ID3v1 in the file when there is APE + ID31
// if there is ONLY id3v1 then this is removes the id3v1 tag
            case '1':
	      f.strip(TagLib::MPEG::File::ID3v1);
	      f.strip(TagLib::MPEG::File::APE);
	      break;

	    default:
	      f.strip(TagLib::MPEG::File::ID3v1 | TagLib::MPEG::File::APE);
	}

        f.save(TagLib::MPEG::File::ID3v2);
    }
    catch (const std::exception& ex)
    {
        std::cerr << ex.what() << std::endl;
    }
    return 0;
}

Activity

  1. Moonbase59 commented on Jul 17, 2019

    @Moonbase59

    Unfortunately, this is also true when using "stripOthers" in f.save() like so:

    f.save(TagLib::MPEG::File::ID3v2, true, 3);
  2. Moonbase59 commented on Jul 17, 2019

    @Moonbase59

    Possible duplicate of #835

  3. whatdoineed2do commented on Jul 17, 2019

    @whatdoineed2do
    ContributorAuthor
  4. Moonbase59 commented on Jul 18, 2019

    @Moonbase59

    Apart from a few disastrous bugs, taglib is a great library and used by many (I think I remember EasyTag, KODI, VLC, Clementine, Mixxx, loudgain, …). With all this groundwork laid out, it’d be a shame to see it go under—or maintainers having to patch it themselves.

    Thanks anyway for bringing this bug up again—I must admit I’d almost missed it (and disappointed my loudgain users).

    I’d REALLY love to see a new fixed version to be picked up by the distros, because end users simply can’t be expected to fix things and compile it themselves!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions