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

Not possible to add multiple images to a flac file #780

Open
sirbeancounter opened this issue Dec 26, 2024 · 3 comments
Open

Not possible to add multiple images to a flac file #780

sirbeancounter opened this issue Dec 26, 2024 · 3 comments

Comments

@sirbeancounter
Copy link

The manual page for metaflac implies that more than one image can be attached to any given flac file as does RFC9639. However this fails due to error opening the flac file.

The following example shows that I can add album art but adding artist art fails:

metaflac --import-picture-from="3|image/jpeg|cover|1411x1385x72/72|album_art.jpeg" 01\ Laundromat\ Blues.flac #works
metaflac --import-picture-from="8|image/jpeg|cover|450x550x150/150|artist_art.jpeg" 01\ Laundromat\ Blues.flac
01 Laundromat Blues.flac: ERROR: writing FLAC file, status = "FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE"

The FLAC file could not be opened.  Most likely the file does not exist
or is not readable.

The following example, after removing album art, shows that I can add artist art but adding album art fails, demonstrating that both images are fine and correctly defined:

metaflac --remove --block-number=3 01\ Laundromat\ Blues.flac
metaflac --import-picture-from="8|image/jpeg|cover|450x550x150/150|artist_art.jpeg" 01\ Laundromat\ Blues.flac #works
metaflac --import-picture-from="3|image/jpeg|cover|1411x1385x72/72|album_art.jpeg" 01\ Laundromat\ Blues.flac
01 Laundromat Blues.flac: ERROR: writing FLAC file, status = "FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE"

The FLAC file could not be opened.  Most likely the file does not exist
or is not readable.

The following example, after removing album art, shows a failing attempt to add both images in one command:

metaflac --remove --block-number=3 01\ Laundromat\ Blues.flac
metaflac --import-picture-from="8|image/jpeg|cover|450x550x150/150|artist_art.jpeg" --import-picture-from="3|image/jpeg|cover|1411x1385x72/72|album_art.jpeg" 01\ Laundromat\ Blues.flac
01 Laundromat Blues.flac: ERROR: writing FLAC file, status = "FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE"

The FLAC file could not be opened.  Most likely the file does not exist
or is not readable.

It seems to me that the code assumes there can only ever be one image per flac file, unless I have misunderstood the manual page.

@ktmf01
Copy link
Collaborator

ktmf01 commented Dec 26, 2024

I don't seem to be able to reproduce this. Please share the version number of metaflac.

Besides that omission, I have a theory: perhaps the padding block is big enough to allow adding for the first picture, but for adding the second picture, a tempfile is needed. Perhaps the directory permissions do not allow for creating a new temp file? The error is consistent with being unable to open a tempfile.

@sirbeancounter
Copy link
Author

It was a good theory, which seems to have been correct. The directory containing the flac files was missing write permission. Now it works as expected.

@ktmf01
Copy link
Collaborator

ktmf01 commented Dec 26, 2024

TODO

  • Add some heuristic to metaflac to detect this situation and explain to the user. Usually an operation where reading works fine but writing back fails could explain such a situation.

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

No branches or pull requests

2 participants