Adding cover art to FLAC files is very slow (approximately 1 to 2 seconds per file) and a temp file is created for each file that is processed. It seems like the entire file is being rewritten. I have tried different sizes and resolutions of images (some as small as 25 KB), but the result is always the same. With other programs (MusicBrainz Picard, TagScanner) the process is nearly instantaneous with no temp files being created. Any thoughts as to why this is occurring?
It's not using a temporary file in all cases, because under certain conditions, padding can be utilized so that writing edited metadata back to the FLAC file does not require rewriting the entire file. If rewriting is required, then a temporary file is used by Mp3tag.
That makes sense. I just did a quick test with a very small image file (10 kb), and the process was very fast with no rewrites. I’m still curious, however, as to how the other programs I mentioned can embed larger image files (1.5 mb) almost instantaneously without the need to rewrite.
Anyway, many thanks for responding so quickly. Your program, and support, are awesome!
I'm also curious I'm using the official FLAC library which has a dedicated function to check whether a rewrite is necessary or not (FLAC__metadata_chain_check_if_tempfile_needed).
— So these other apps either use a different approach or you've tried it with files that were previously tagged by Mp3tag and, by that, had enough internal padding to be used to embed the images.
I am testing with the same newly ripped files (I used fre:ac), so they must be using a different approach. Is it possible that they are increasing the padding first and then embedding the cover art?
Just for fun, I ran two more tests using 46 newly ripped FLAC files and a 500x500 101KB image.
Test 1 – I used Mp3tag to embed the image. It took almost 1 minute, and temporary files were created.
Test 2 – I first used the metaflac command line option --add-padding=# to add 110KB of padding to the files. This was very quick, about 1 second, so I’m guessing that the files were not rewritten. I then used Mp3tag to embed the image. This was also very quick, about 1 second, and I didn’t notice any temporary files being created.
This is way beyond my knowledge (all of this is very new to me), but perhaps the other apps are using a similar approach… increasing the padding to accommodate the image size first, and then embedding the image.