taglib-ruby icon indicating copy to clipboard operation
taglib-ruby copied to clipboard

Saving corrupts some Ogg Vorbis files

Open jangler opened this issue 7 years ago • 6 comments

This doesn't happen with all Ogg Vorbis files, but it does with these two that someone else provided: https://github.com/jangler/taffy/files/1844917/files.zip

In irb:

require 'taglib'
=> true
TagLib::FileRef.open('filename.ogg') do |fileref|
  fileref.save
end
=> true

Afterward, ffprobe says filename.ogg: End of file, soxi says soxi FAIL formats: can't open input file 'filename.ogg': Input not an Ogg Vorbis audio stream, and mpv says Failed to recognize file format..

jangler avatar Mar 25 '18 02:03 jangler

This looks like a taglib problem, I can reproduce it at that level.

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

int main(int argc, char **argv) {
  if (argc != 2) {
    std::cout << "usage: " << argv[0] << " file.ogg" << std::endl;
    exit(1);
  }

  const char *filename = argv[1];

  TagLib::FileRef file(filename);

  std::cerr << "saving " << filename << " with taglib." << std::endl;

  if (!file.save()) {
    std::cerr << "file save failed" << std::endl;
    exit(1);
  }
}

@jangler I don't think this has anything to do with taglib-ruby. I can reproduce your error by compiling the file above with TagLib 1.11 (MacPorts) and running it on one of your OGG files.

jacobvosmaer avatar Mar 25 '18 13:03 jacobvosmaer

I suspected that might be the case, but I've never used TagLib itself so I reported the issue here. But I would say that this does have a good deal to do with taglib-ruby, since taglib-ruby currently propogates this serious bug and does not in any way document it. There's no telling when the bug will be fixed in TagLib itself (which has not been updated in four months despite many open PRs) or when the fixed version of TagLib will become available in various package manager repos, so it's possible for taglib-ruby to intervene in the interim, if the developers so desire.

jangler avatar Mar 25 '18 16:03 jangler

I will open an issue for this in the TagLib issue tracker, since it doesn't look like one currently exists.

Edit: Here it is: https://github.com/taglib/taglib/issues/864

jangler avatar Mar 25 '18 16:03 jangler

Thanks for posting an issue upstream @jangler.

jacobvosmaer avatar Mar 25 '18 21:03 jacobvosmaer

so it's possible for taglib-ruby to intervene in the interim, if the developers so desire

I don't think we have a good way to do that, except for not allowing to save ogg files at all.. Open for ideas though.

robinst avatar Mar 26 '18 00:03 robinst

Looks like the upstream issue has been resolved, I think we can close this now?

robinst avatar Apr 12 '24 09:04 robinst