Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: removing binary tags from wavpack files (Read 5574 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

removing binary tags from wavpack files

Running Gentoo Linux

I have some wavpackfiles that contain the tag
Cover Art (front)=[603264 bytes]


This is causing issues (overruns) with my file converter. Looking around the wavpack documentation i don't see how to remove those tags.  My tag editors (exfalso and picard) don't seem to recognize that the tags exist, but mutagen-inspect and mplayer see them.

How can i remove them?

Thanks
Music lover and recovering high end audiophile

removing binary tags from wavpack files

Reply #1
I'm not sure about any Linux tool to do that...obviously something like Mp3Tag for Windows would do it.

I created a quick patch for wvgain to add a -b option to remove all binary items that should do the trick (I know you've been building the cli programs). The only disadvantage of this method is that when the WavPack library is used to edit tags the files cannot become smaller (a gap is added before the tag) so in your case you would be wasting that 600k.

I spent about 15 minutes on this, so please make a backup of your files before trying it and maybe try a few files first and make sure it really fixes your problem (and doesn't break something else). I would still use a Windows tool instead... 

Sorry about the codebox...the system would not let me attach this type of file (whatever that means).

David

Code: [Select]
--- cli/wvgain.c	(revision 247)
+++ cli/wvgain.c (working copy)
@@ -72,6 +72,7 @@
 " Usage:  WVGAIN [-options] [@]infile[.wv] [...]\n"
 "            (infiles may contain wildcards: ?,*)\n\n"
 " Options: -a  = album mode (all files scanned are considered an album)\n"
+"          -b  = remove binary tags from all files (no ReplayGain analysis)\n"
 "          -c  = clean ReplayGain values from all files (no analysis)\n"
 "          -d  = display calculated values only (no files are modified)\n"
 "          -i  = ignore .wvc file (forces hybrid lossy)\n"
@@ -92,7 +93,7 @@
 #define HISTOGRAM_SLOTS 12000
 static uint32_t track_histogram [HISTOGRAM_SLOTS], album_histogram [HISTOGRAM_SLOTS];
 
-static char album_mode, clean_mode, display_mode, ignore_wvc, quiet_mode, show_mode, new_mode;
+static char album_mode, clean_mode, remove_binary_mode, display_mode, ignore_wvc, quiet_mode, show_mode, new_mode;
 static int num_files, file_index;
 
 /////////////////////////// local function declarations ///////////////////////
@@ -161,6 +162,10 @@
                        album_mode = 1;
                        break;
 
+                    case 'B': case 'b':
+                        remove_binary_mode = 1;
+                        break;
+
                    case 'C': case 'c':
                        clean_mode = 1;
                        break;
@@ -213,7 +218,7 @@
 
    // check for various command-line argument problems
 
-    if (clean_mode && (album_mode || display_mode || show_mode)) {
+    if ((remove_binary_mode || clean_mode) && (album_mode || display_mode || show_mode)) {
        error_line ("clean mode can't be used with album, show, or display mode!");
        ++error_count;
    }
@@ -335,7 +340,7 @@
        // track of everything and modify the tags in another pass. If we're not in
        // album mode then we can update the files here.
 
-        for (file_index = 0; !clean_mode && !show_mode && file_index < num_files; ++file_index) {
+        for (file_index = 0; !remove_binary_mode && !clean_mode && !show_mode && file_index < num_files; ++file_index) {
            if (check_break ())
                break;
 
@@ -419,7 +424,7 @@
        // the tags (or just show existing stored values).
 
        if (result != HARD_ERROR)
-            for (file_index = 0; (clean_mode || album_mode || show_mode) && !display_mode && file_index < num_files; ++file_index) {
+            for (file_index = 0; (remove_binary_mode || clean_mode || album_mode || show_mode) && !display_mode && file_index < num_files; ++file_index) {
                if (check_break ())
                    break;
 
@@ -624,9 +629,26 @@
        return SOFT_ERROR;
    }
 
-    if (clean_mode) {
+    if (remove_binary_mode) {
        int items_removed = 0;
+        char tag_item [256];
 
+        while (WavpackGetBinaryTagItemIndexed (wpc, 0, tag_item, sizeof (tag_item)))
+            if (WavpackDeleteTagItem (wpc, tag_item))
+                ++items_removed;
+            else
+                break;
+
+        if (!quiet_mode && items_removed) {
+            error_line ("%d binary items removed", items_removed);
+            write_tag = TRUE;
+        }
+        else
+            error_line ("no binary items found");
+    }
+    else if (clean_mode) {
+        int items_removed = 0;
+
        if (WavpackDeleteTagItem (wpc, "replaygain_track_gain"))
            ++items_removed;

removing binary tags from wavpack files

Reply #2
I'm not sure about any Linux tool to do that...obviously something like Mp3Tag for Windows would do it.


Mp3tag works fine under Wine, if one has Wine available....


"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts


removing binary tags from wavpack files

Reply #4
Thanks folks. i finally got back to this and mp3tag worked fine under wine 1.4.1.

Bryant, do you want/need me to try to recreate these files and test your patch?
Music lover and recovering high end audiophile

removing binary tags from wavpack files

Reply #5
Bryant, do you want/need me to try to recreate these files and test your patch?

No need to bother. Without recovering the space used by the deleted tags, it's not a recommended solution. Glad Mp3tag worked for you!