xiph / xiph/flac

Not possible to add multiple images to a flac file

Open
#780 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2.4k
Forks
363
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the metaflac --import-picture-from commands shown in the issue, including adding the images in both orders and in one command. Trace the metadata-chain handling behind metaflac and verify that multiple picture blocks can be written without the FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.