Bug 107659 - FLAC tagging extremely slow
Summary: FLAC tagging extremely slow
Status: RESOLVED FIXED
Alias: None
Product: taglib
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-18 15:11 UTC by Yves Glodt
Modified: 2009-07-12 23:53 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
flacfile.cpp patch for efficient flag tag updates (4.39 KB, patch)
2006-01-22 01:10 UTC, Toby Dickenson
Details
very small flacfile.h patch (532 bytes, patch)
2006-01-22 01:18 UTC, Toby Dickenson
Details
flacfile.cpp diff (3.13 KB, patch)
2008-09-11 09:50 UTC, Andrew Gatt
Details
flacfile.h diff (358 bytes, patch)
2008-09-11 09:52 UTC, Andrew Gatt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yves Glodt 2005-06-18 15:11:23 UTC
Version:           1.2.4 (using KDE KDE 3.4.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Changing the "Title" tag in a flac file takes about 20 seconds on an Athlon XP2200, this is quite slow... :-( Speeding it up would be great.
Comment 1 Alexandre Oliveira 2005-06-22 02:06:40 UTC
For any file, or just with specific ones?
At the moment I only have one flac file. It has 20MB, and changing the track took about 8 seconds here (I have a Athon 1800+), both with amaroK and JuK. I agree It seems to be too much, but as I don't know anything about how tags work in FLAC files, I can't really tell.

As taglib handles all the tagging work, I'm passing this bug to them.
Comment 2 Scott Wheeler 2005-06-22 02:11:06 UTC
Sorry, but that's just because FLAC's tagging format is especially silly.  (They use the same format as Ogg Vorbis, which is even less appropriate given the file sizes.)

Basically the tag is at the front of the file and there's no provision for "padding" as in ID3v2.  So if you change the author and make it one character longer, you have to move the remaining 20 MB of the file back by one byte which is, well, slow.
Comment 3 Gunnar Roth 2005-07-02 15:05:14 UTC
this is not true.
please google for FLAC__metadata_chain_sort_padding...

regards,
gunnar
Comment 4 Toby Dickenson 2006-01-22 01:10:14 UTC
Created attachment 14331 [details]
flacfile.cpp patch for efficient flag tag updates

Attached is a patch which solves this issue. Where possible a flac file's tags
are edited in place by shrinking any padding block which follows immediately
after the comment block.

If the padding block is too small (or not present) then this efficient method
is not possible, and therefore the file has to be completely rewritten. This
patch will insert another padding frame to allow for efficient future small
additions.

With this patch, juk can bulk edit flac tags at approximately 10 per second.
Without, it takes over 10 seconds to edit one file's tags.

Flac file format reference:
http://flac.sourceforge.net/format.html#format_overview
Comment 5 Toby Dickenson 2006-01-22 01:18:54 UTC
Created attachment 14332 [details]
very small flacfile.h patch
Comment 6 Scott Wheeler 2006-01-23 14:31:33 UTC
Reopening for now until padding is implemented.  Toby -- your patch wasn't complete.  It just contained the one line change to the header.
Comment 7 Toby Dickenson 2006-01-23 20:30:01 UTC
There are two patches attached - you need them both.
Comment 8 Brian Nickel 2006-07-21 02:17:58 UTC
Could this code (similar) be applied to TagLib::Ogg?
Comment 9 Allan Sandfeld 2006-07-21 11:02:52 UTC
Simple answer: no

The current ogg-packet/page access-layer doesn't support something like this.
Comment 10 Andrew Gatt 2008-09-11 09:50:14 UTC
Created attachment 27366 [details]
flacfile.cpp diff
Comment 11 Andrew Gatt 2008-09-11 09:52:56 UTC
Created attachment 27367 [details]
flacfile.h diff

I have updated the patch to work with 1.5 - simple variable name change so i haven't really done anything. As before you need this and the above diffs. It speeds up the writes massively and is a good feature to include in the next release.
Comment 12 Scott Wheeler 2009-07-12 23:53:19 UTC
SVN commit 995518 by wheeler:

Use flac padding.

Updated patch from Toby Dickenson

BUG:107659


 M  +76 -7     flacfile.cpp  
 M  +1 -0      flacfile.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=995518