How to decrease the tagsize after deleting coverart

I just received some FLAC files that had coverart embedded. The .jpg files that were embedded were however way too big: about 4-6 MB per FLAC!
MP3Tag took ages to read these huge tags in the total of 230 files, probably because of these huge tagsizes. So I deleted all coverart via the "extended tags".

However, the tagsize is still indicated to be between 4 and 6 MB per FLAC, even after the deletion of all coverart ...

Is there any way decrease the tagsize ? I already deleted all tags and pressed "undo", without any result.

After some searching I found that apparently the space in the FLAC used by an embedded image is indeed "padded" when removing the image.

So the question seems to be how to remove this huge padding in the picture metadata block.
I saw that perhaps this could be done with Metaflac, if I understand correctly using the switches: "--remove --block-type=PADDING --dont-use-padding"
Can this be made to work only on the picture metadata?

Alternatively, I saw that there was also a switch "--remove-all --dont-use-padding"
But would this also delete the normal tags such as "title" and I'm not quite sure whether this would also remove existing padding ...

Anyway, this is becoming a bit too technical for me, does someone have any experience with this?

Sorry to keep answering myself, but I found a solution via metaflac used in a batchfile, that seems to work.

@echo off
title Reduce padding in FLAC - all files in directory
for %%i in (*.flac) do (
echo Removing padding from "%%~ni.flac" ...
"\metaflac.exe" --remove --block-type=PADDING --dont-use-padding "%%~ni.flac"
if ERRORLEVEL 1 goto error
echo Adding 4096 bytes of padding ...
"\metaflac.exe" --add-padding=4096 "%%~ni.flac"
if ERRORLEVEL 1 goto error
echo -- Done
echo.
)
echo.
echo -- Padding reduced
goto end
:error
echo.
echo ---- ERROR REDUCING PADDING ---- batch process stopped
:end
echo.
pause
exit

Save this as f.i. "ReduceFLACPadding.bat" and place in the right-context-menu folder of explorer. This will reduce any oversized padding in all FLACs in the directory to a standard 4096 bytes, leaving the existing tags intact.

I also had audio files with huge cover art, and hopped I could find help here, but not much.
Turned out that J. River Media Center do the job easily, and version 12 is free.
However do not scan to update the library, as Media Center will embed the cover art by default.

I'm so free and hijack this thread about the padding size in FLAC files, and want to give thanks to Lupercus for his batch file using the commandline tool "metaflac.exe", which I have used as a template.
I wrote an extended version of the batch file, see attachment.

@ECHO OFF

REM ================================================================================
REM Purpose: Change the padding size within all FLAC files in the given folder .
REM The given folder path name can be dropped onto this batch file ...
REM ... or can be set as the first parameter on the command line.
REM This CMD script is an extended version of the CMD script from Mp3tag user "Lupercus, Sep 5 2009, 13:52" .
REM Detlev Dalitz.20140106.
REM ================================================================================
REM Define the fully qualified path to the file "metaflac.exe".

SET METAFLAC="P:\Programs\FLAC\metaflac.exe"
REM Define the padding default size in Bytes.
REM The pad size is allowed to be an integer value in the range from 0 to 16777215.

SET PADSIZE_DEFAULT=2000
REM ================================================================================
ECHO.[%~n]
ECHO.
ECHO.Set padding for all FLAC files in the current folder ...
CD /D "%~f1"
ECHO."%CD%"
IF NOT EXIST ".FLAC" (
ECHO.
ECHO.FLAC files not found.
GOTO END
)
:GET_PADSIZE

ECHO.
SET PADSIZE_INPUT=%PADSIZE_DEFAULT%
SET /P PADSIZE_INPUT=Give padding size in Bytes (default %PADSIZE_DEFAULT%):
SET /A PADSIZE_EVAL=1
%PADSIZE_INPUT%
IF %PADSIZE_EVAL% NEQ %PADSIZE_INPUT% (
ECHO.Enter an integer number in the range ...
ECHO.decimal ...: from 0 to 16777215
ECHO.hexadecimal: from 0 to 0xffffff
ECHO.octal .....: from 00 to 077777777
GOTO GET_PADSIZE
)

ECHO.Set padding to %PADSIZE_EVAL% Bytes.
ECHO.
ECHO.Press [Enter] to continue or [Ctrl+C] to exit.
PAUSE >NUL
ECHO
.
SET COUNT=0
FOR %%f IN ("*.FLAC") DO (
REM ATTRIB -R "%%~nxf"
REM ECHO."%%~nxf"
REM ECHO.%%~ftzaf

SET /A COUNT=!COUNT!+1
ECHO.
ECHO.!COUNT!:
ECHO.Remove padding from ...
DIR /N/4 "%%f"|FIND "%%f"
%METAFLAC% --dont-use-padding --remove --block-type=PADDING "%%~nxf"
IF ERRORLEVEL 1 GOTO ERROR
ECHO.Add padding %PADSIZE_EVAL% Bytes ...
%METAFLAC% --add-padding=%PADSIZE_EVAL% "%%~nxf"
IF ERRORLEVEL 1 GOTO ERROR
DIR /N/4 "%%f"|FIND "%%f"
ECHO.
REM PAUSE

)

ECHO.
ECHO.Ready.
GOTO END
:ERROR

ECHO.
ECHO.Error on reducing padding ... batch process stopped.

:END

ECHO.
PAUSE
EXIT

MetaFlac.SetPadding.cmd.txt (2.25 KB)
For usage remove the extension ".txt" from the filename.

DD.20140106.2356.CET

Note:
This cmd script makes use of "delayed variable expansion".
To use delayed variable expansion it must be enabled.

This can be done using CMD /V:ON /C to start the batch file, ...
or better insert the code line ...
SETLOCAL ENABLEDELAYEDEXPANSION
... inside the batch file.

To make it permanently ...
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"DelayedExpansion"=dword:00000001

DD.20150515.1120.CEST

MetaFlac.SetPadding.cmd.txt (2.25 KB)

Hi Detlev,

I really like your script.

But I get two "errors". The Script itself works fine.

Set padding for all FLAC files in the current folder ...
Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung
ist falsch.
"F:\__Comedy\Badesalz\[1991-00-00] Nicht Ohne Meinen Pappa"

And before every file:

Fehlender Operator

The only thing I did was to change the path to the metaflac.exe.

Also I would appreciate it if instead of stopping the script on an error to put the errornous file into a txt-file. Full qualified path + txt-file can be written to any location and not just the source directory.

I have just no time to dig into the problem.

Maybe the path to the metaflac.exe file contains one ore more space characters? Do avoid this.
Or ... try to enclose the DOS variable into Double Apostrophes.
%METAFLAC% ==> "%METAFLAC%"
I don't know if this can help.

Feel free to modify the batch script to your needs.

DD.20141202.1348.CET

i get same errors but works fine
however is it possible this batch works with subfolders ?
i try unsuccessfuly to change it
thanks a lot Detlev

The "MetaFlac.SetPadding.cmd" batch file accepts only one parameter, ...
which is given as a commandline parameter, ...
or given by drag and drop onto the commandfile's icon.
This parameter is the folderpathname of the folder, which contains the *.flac files to be changed.
Recursive walk through a foldertree is not implemented.

DD.20150514.1935.CEST

A little help please, I got this error: "P:\Programs\FLAC\metaflac.exe" not recognized as an internal or external command

You have to edit the code and set the call of the program to the actual location in your filesystem where metaflac.exe can be found.
modify this line:
SET METAFLAC="P:\Programs\FLAC\metaflac.exe"

what a noob... Thanks a lot. :smiley: :music:

Something else to note: You can use metaflac.exe to remove the images themselves. No need to do it manually in Mp3tag and then run a script to remove the excess padding.

--remove --block-type=PICTURE

And if you wish to preserve file modification times, use:

--preserve-modtime

I know this is an old(er) topic, but since the topic araised again in the german section I wanted to post my solution here as well:

Mp3tag has the very useful Tools feature which allows to call external programs from inside mp3tag.
With this it is possible to extend mp3tag with metafalc features:

  • in the menu bar select File -> Options...
  • in the left panel select Tools
  • click the "New" button
  • choose a name so you can identify your new tool
  • select the path to the metaflac.exe (part of the flac for windows command line tools: FLAC - Downloads)
  • add the parameters (metafalc parameters, mp3tag tools parameters)

Metaflac doesn't support two major operations at the same time so to reduce the padding and afterwards restore the standard padding size it's necessary to use two different "Tools":

Tool 1: This is to remove the embedded cover(s) (if present) and reduce the padding size so the space which was occupied by the cover is no longer used
Name: METAFLAC: remove covers; shrink padding
Path: ...\path\to\metaflac.exe
Parameters: --remove --block-type=PICTURE,PADDING --dont-use-padding "%_path%"

Tool 2: This restores the standard padding size of 8192 bytes. (Files with audio stream > 20mins normally uses a standard PADDING of 65536 bytes; You can specify a third Tool for this if you want)
Name: METAFLAC: restore std. padding size
Path: . ..\path\to\metaflac.exe
Parameters: --add-padding=8192 "%_path%"

make sure that for both tools the for all selected files is checked

Afterwards the scripts can be found in the context menu (right click) under Tools. The commands are executed for every selected file.

You have to run Tool 1 first and afterwards Tool 2.

1 Like

Couldn't you just create a .bat or .cmd file and use something like this and combine the two?

@echo off
"metaflac.exe" --preserve-modtime --remove --block-type=PICTURE,PADDING --dont-use-padding "%~1" && echo "%~nx1" - padding removed
"metaflac.exe" --preserve-modtime --add-padding=8192 "%~1" && echo "%~nx1" - Padding added
pause

Then create a tool like so:
Name: METAFLAC: Fix padding
Path: C:\Users\username\Desktop\metaflac.cmd
Parameters: "%_path%"

You could do a loop in the batch file and remove the for all files and pass the "%_path%" parameter as the variable in the batch file if you don't want multiple consoles coming up. But there's already that here.

You might also want to consider the --preserve-modtime switch.

2 Likes

Of course with a batch file you can combine both operations :+1:

With the pause at the end of the batch the cmd windows will stay open.
It's good if you want to see if the operation was sucessful or any errors occured but can be also very frustrating if dealing with a large number of files and therefore a large number of open cmd windows.

You could tweak it so that it only stays open if an error occured:

@echo off
"metaflac.exe" --preserve-modtime --remove --block-type=PICTURE,PADDING --dont-use-padding "%~1" && echo "%~nx1" - padding removed
if NOT %ERRORLEVEL% EQU 0 GOTO :ERROR
"metaflac.exe" --preserve-modtime --add-padding=8192 "%~1" && echo "%~nx1" - Padding added
if NOT %ERRORLEVEL% EQU 0 GOTO :ERROR
GOTO :END
:ERROR
pause
:END

Adding additional parameters like --preserve-modtime is always possible and is a personal preference.


A loop in the batch is also possible if you want to run it on a folder base instead.
Than you have to use the "%_folderpath%" variable instead (or extract the folder from the filenmae inside the batch).
And you have to call it for each folder separately since without the "for each file" flag mp3tag runs the script for the first (marked) file only.

For me the benefits from running it from inside mp3tag is that I can run it on specific files but you loose that possibility if you run it on a folder base.
For a folder based approach an independent batch file is imho the better solution.



I wrote the following script exactly for this purpose.

It's a more advanced version of the script posted above.
It has a few settings that can be changed while the script is running:

  • file or folder
  • include subfolders
  • preserve modtime
  • reduce padding after cover is removed
  • restore standard padding

I saved the metaflac.exe and my coverflac.bat in the same folder and added the folder to the windows path variable. This way i can run the script from any folder by just opening a cmd window and run coverflac.

rem ----------------------------
rem 2020-08-07 V1.1
rem     fixed: script failure if selected file or folder contains some special characters
rem 2020-08-01 V1.0
rem     initial release
rem ----------------------------
@echo off
chcp 65001
rem --------------------------------------------------
rem standard settings change this to your preferences:
set dirOrFile=".\"
set includeSubDir=no
set reducePadding=yes
set restoreStdPadding=yes
set preserveModtime=no
rem --------------------------------------------------
set fileType=none
set option=0
set menu=0

:START
cls
echo ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
echo  ■          ▄█████ ██                      ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
echo  ■   ■      ██     ██                      █ \   COVER   / █
echo  ■ ■ ■    ██████   ██  ▄██████▄  ▄██████▄  █   \       /   █
echo  ■ ■ ■      ██     ██        ██  ██        █     \   /     █
echo  ■ ■ ■      ██     ██  ▄███████  ██        █      ART      █
echo  ■ ■ ■ ■    ██     ██  ██    ██  ██        █     /   \     █
echo  ■ ■ ■ ■    ██     ██  ██    ██  ██        █   /       \   █
echo  ■ ■ ■ ■    ██     ██  ▀██████▀  ▀██████▀  █ /  REMOVER  \ █
echo  ■ ■ ■ ■  free   lossless   audio   codec  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
echo ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
echo                     V1.1 - (C) 2020 Doni
echo ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
rem check and correct settiongs:
if /I not "%includeSubDir%"=="yes" (
	set includeSubDir=no
) else (
	set includeSubDir=yes
)
if /I not "%reducePadding%"=="yes" (
	set reducePadding=no
) else (
	set reducePadding=yes
)
if /I not "%restoreStdPadding%"=="yes" (
	set restoreStdPadding=no
) else (
	set restoreStdPadding=yes
)
if /I not "%preserveModtime%"=="yes" (
	set preserveModtime=no
) else (
	set preserveModtime=yes
)

rem show actual settiongs:
echo SETTINGS:
echo ---------
set dirOrFile=%dirOrFile:/=\%
set dirOrFile=%dirOrFile:"=%
FOR %%i IN ("%dirOrFile%") DO set dirOrFile=%%~fi
if exist "%dirOrFile%" (
	if /I "%dirOrFile:~-5%"==".flac" (
		set fileType=file
	) else (
		if "%dirOrFile:~-2%"=="\*" (
			set fileType=folder
		) else (
			if "%dirOrFile:~-1%"=="\" (
				set fileType=folder
			) else (
				if exist "%dirOrFile%\*" (
					set fileType=folder
				) else (
					set dirOrFile=""
					set fileType=none
				)
			)
		)
	)
) else (
	set dirOrFile=""
)


if "%fileType%"=="none" (
	echo no file or folder selected
) else (
	if "%fileType%"=="folder" (
		pushd "%dirOrFile%"
		if "%includeSubDir%"=="yes" (
			for /f "delims=" %%a in ('2^>nul dir /B /A:-D-S /S *.flac ^| find /c /v ""') do set cnt=%%a
		) else (
			for /f "delims=" %%a in ('2^>nul dir /B /A:-D-S *.flac ^| find /c /v ""') do set cnt=%%a
		)
		popd
		SetLocal EnableDelayedExpansion
		echo selected folder:                     "!dirOrFile!"
		if "%includeSubDir%"=="yes" (
			echo                                      found !cnt! FLAC files in folder and subfolders
		) else (
			echo                                      found !cnt! FLAC files in folder
		)
		echo include sub directories:             %includeSubDir%
		EndLocal
	) else (
		echo selected file:                       "%dirOrFile%"
	)
)
echo reduce padding:                      %reducePadding%
if "%reducePadding%"=="yes" echo restore standard padding:            %restoreStdPadding%
echo preserve original modification time: %preserveModtime%
echo ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄

rem Menu and Options
if %menu%==0 (
	if %option%==0 GOTO :MAIN_MENU
	if %option%==1 GOTO :FILE_AND_FOLDER_SETTINGS
	if %option%==2 GOTO :CHANGE_SETTINGS
	if %option%==3 GOTO :COVER_REMOVAL
	if %option%==4 GOTO :END
)
if %menu%==1 GOTO :SETTINGS

:MAIN_MENU
set menu=0
set option=0
echo (1) Select Folder or File
echo (2) Settings
echo (3) Start Cover Removal
echo (4) EXIT

:ENTER_OPTION
set /p option="select option: "
set option=%option: =%
set option=%option:"=%
if %menu%==0 (
	if not "%option%"=="1" (
		if not "%option%"=="2" (
			if not "%option%"=="3" (
				if not "%option%"=="4" (
					set option=0
				)
			)
		)
	)
)
GOTO :START

rem -------------------------------

:FILE_AND_FOLDER_SETTINGS
set dirOrFile=""

:FILE_AND_FOLDER_SETTINGS_CHANGE_DIR_OR_FILE
if not exist "%dirOrFile%" GOTO :SET_DIR_OR_FILE
if exist "%dirOrFile%" (
	if /I "%dirOrFile:~-5%"==".flac" (
		set fileType=file
	) else (
		set fileType=folder
		if not "%dirOrFile:~-2%"=="\*" (
			if not "%dirOrFile:~-1%"=="\" (
				if not exist "%dirOrFile%\*" (
					GOTO :NOT_FLAC_FILE_OR_FOLDER
				)
			)
		)
	)
) else (
	GOTO :NOT_FLAC_FILE_OR_FOLDER
)

set menu=0
set option=0
GOTO :START

rem -------------------------------

:CHANGE_SETTINGS
set includeSubDir=""
set reducePadding=""
set restoreStdPadding=""
set preserveModtime=""

:CHANGE_SETTINGS_INCLUDE_SUB_DIR
if not "%includeSubDir%"=="yes" (
	if not "%includeSubDir%"=="no" GOTO :SET_INCLUDE_SUB_DIR
)

:CHANGE_SETTINGS_REDUCE_PADDING
if not "%reducePadding%"=="yes" (
	if not "%reducePadding%"=="no" GOTO :SET_REDUCE_PADDING
)

:CHANGE_SETTINGS_RESTORE_STD_PADDING
if "%reducePadding%"=="yes" (
	if not "%restoreStdPadding%"=="yes" (
		if not "%restoreStdPadding%"=="no" GOTO :SET_RESTORE_STD_PADDING
	)
) else (
	set restoreStdPadding=no
)

:CHANGE_SETTINGS_PRESERVE_MODTIME
if not "%preserveModtime%"=="yes" (
	if not "%preserveModtime%"=="no" GOTO :SET_PRESERVE_MODTIME
)

set menu=0
set option=0
GOTO :START

rem -------------------------------

:NOT_FLAC_FILE_OR_FOLDER
echo "%dirOrFile%"
echo is not a directory or flac file
GOTO :SET_DIR_OR_FILE

:SET_DIR_OR_FILE
set /p dirOrFile="enter valid directory or flac file: "
set dirOrFile=%dirOrFile:"=%
set dirOrFile=%dirOrFile:/=\%
FOR %%i IN ("%dirOrFile%") DO set dirOrFile=%%~fi
GOTO :FILE_AND_FOLDER_SETTINGS_CHANGE_DIR_OR_FILE

:SET_INCLUDE_SUB_DIR
set /p includeSubDir="include sub directories y/n: "
if /I "%includeSubDir%"=="n" set includeSubDir=no
if /I "%includeSubDir%"=="no" set includeSubDir=no
if /I "%includeSubDir%"=="y" set includeSubDir=yes
if /I "%includeSubDir%"=="ye" set includeSubDir=yes
if /I "%includeSubDir%"=="yes" set includeSubDir=yes
GOTO :CHANGE_SETTINGS_INCLUDE_SUB_DIR

:SET_REDUCE_PADDING
set /p reducePadding="reduce PADDING after covers are removed  y/n: "
if /I "%reducePadding%"=="n" set reducePadding=no
if /I "%reducePadding%"=="no" set reducePadding=no
if /I "%reducePadding%"=="y" set reducePadding=yes
if /I "%reducePadding%"=="ye" set reducePadding=yes
if /I "%reducePadding%"=="yes" set reducePadding=yes
GOTO :CHANGE_SETTINGS_REDUCE_PADDING

:SET_RESTORE_STD_PADDING
set /p restoreStdPadding="restore standard PADDING block size y/n: "
if /I "%restoreStdPadding%"=="n" set restoreStdPadding=no
if /I "%restoreStdPadding%"=="no" set restoreStdPadding=no
if /I "%restoreStdPadding%"=="y" set restoreStdPadding=yes
if /I "%restoreStdPadding%"=="ye" set restoreStdPadding=yes
if /I "%restoreStdPadding%"=="yes" set restoreStdPadding=yes
GOTO :CHANGE_SETTINGS_RESTORE_STD_PADDING

:SET_PRESERVE_MODTIME
set /p preserveModtime="keep file modification time untouched y/n: "
if /I "%preserveModtime%"=="n" set preserveModtime=no
if /I "%preserveModtime%"=="no" set preserveModtime=no
if /I "%preserveModtime%"=="y" set preserveModtime=yes
if /I "%preserveModtime%"=="ye" set preserveModtime=yes
if /I "%preserveModtime%"=="yes" set preserveModtime=yes
GOTO :CHANGE_SETTINGS_PRESERVE_MODTIME

rem -------------------------------

:COVER_REMOVAL
if "%fileType%"=="none" (
	echo ERROR - no file or folder selected
	pause
	set menu=0
	set option=0
	GOTO :START
)
if "%fileType%"=="file" (
	CALL :REMOVE_COVER "%dirOrFile%"
) else (
	if "%includeSubDir%"=="yes" (
		pushd "%dirOrFile%"
		for /f "delims=" %%a in ('2^>nul dir /B /A:-D-S /S *.flac') do CALL :REMOVE_COVER "%%~fa"
		popd
	) else (
		pushd "%dirOrFile%"
		for /f "delims=" %%a in ('2^>nul dir /B /A:-D-S "*.flac"') do CALL :REMOVE_COVER "%%~fa"
		popd
	)
	
)
echo finished cover removal
pause
set menu=0
set option=0
GOTO :START

:END
cls

EXIT /B
rem ========== FUNCTIONS ==========

:REMOVE_COVER
	set error=""
	set metaflacCommand=""
	dir /ar %1 >nul 2>nul && set error="file is marked as readonly"
	if %error%=="" (
		if "%reducePadding%"=="yes" (
			if "%preserveModtime%"=="yes" (
				set metaflacCommand="metaflac --remove --block-type=PICTURE,PADDING --dont-use-padding --preserve-modtime"
				metaflac --remove --block-type=PICTURE,PADDING --dont-use-padding --preserve-modtime %1 2>nul
			) else (
				set metaflacCommand="metaflac --remove --block-type=PICTURE,PADDING --dont-use-padding"
				metaflac --remove --block-type=PICTURE,PADDING --dont-use-padding %1 2>nul
			)
		) else (
			if "%preserveModtime%"=="yes" (
				set metaflacCommand="metaflac --remove --block-type=PICTURE,PADDING --preserve-modtime"
				metaflac --remove --block-type=PICTURE,PADDING --preserve-modtime %1 2>nul
			) else (
				set metaflacCommand="metaflac --remove --block-type=PICTURE,PADDING"
				metaflac --remove --block-type=PICTURE,PADDING %1 2>nul
			)
		)
		SetLocal EnableDelayedExpansion 
		if not !ERRORLEVEL! EQU 0 set error="removing cover"
		EndLocal

		if %error%=="" (
			if "%restoreStdPadding%"=="yes" (
				if "%preserveModtime%"=="yes" (
					set metaflacCommand="metaflac --add-padding=8192 --preserve-modtime"
					metaflac --add-padding=8192 --preserve-modtime %1 2>nul
				) else (
					set metaflacCommand="metaflac --add-padding=8192"
					metaflac --add-padding=8192 %1 2>nul
				)
				SetLocal EnableDelayedExpansion 
				if not !ERRORLEVEL! EQU 0 set error="restoring standard PADDING"
				EndLocal
			)
		)
	)
	set error=%error:"=%
	if "%error%"=="" (
		echo [OK] "%~n1%~x1"
	) else (
		echo [  ] "%~n1%~x1"
		if %metaflacCommand%=="" (
			echo        ERROR: %error%
		) else (
			echo        ERROR: %error% with '%metaflacCommand:~1,-1% %1'
		)
	)
	EXIT /B 0
2 Likes

Good job!!

I wrote a similar one for a DJ friend. I cannot share it as he paid me for it and asked me not to release it anywhere. But it checks for MQA files, Cover removal, padding setting, spectrogram creation with SoX which will skip any previously output spectrograms, read-only removal, Encode and skip error checking with sub-directory support. It's for use in FreeCommander so all he has to do is select the folders or files and click the toolbar icon for it.

I should've really written it in PowerShell as it's easier to implement multi-threading as outputting the Spectrograms is slow using a single one.

@Doni and @stevehero - Just a little addition/replacement for your PAUSE command:
Since Windows Vista there is command called TIMEOUT. It combines a PAUSE with a timer.

So you can use it like this in your batch files:
timeout /t 120
this would wait 120 seconds before the command processor continues processing without any user interaction (or close the window, if it is the last command in a batch).

If you want an "unbreakable" 120 second timeout (ignoring any keystroke), you can use it like this:
timeout /t 120 /nobreak

To simulate a PAUSE (and wait indefinitely until a key is pressed), you could use:
timeout /t -1

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.