remove (approx) from duration tag?

Started by tlm2408, October 13, 2017, 10:46:44 AM

Previous topic - Next topic

tlm2408

When I use the duration tag for id3 files I get the result 0:00:00 (approx). Is there anyway I can remove the (approx) part? there is a space before (approx) that I need to remove too.

Thank you for any help recieved.
Greg

Phil Harvey

Hi Greg,

There are various ways to do this.  Since I don't know what you are doing with this value, I will list a some of the techniques:

1) Use -n or -duration# to get the duration in seconds.

2) If using $duration in an expression, use ${duration;s/ \(.*//} instead.

3) Use the API Filter option to remove " (approx)" from all tag values: -api filter="s/ \(approx\)//"

4) Create a custom user-defined tag to format Duration any way you want.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tlm2408

Hi phil thank you for the quick reply. Sorry total newbie here. I have a batchfile that copies metadata from mp3s to seperate divs in a html file. Here's my batch:

exiftool.exe -LameStereoMode -AudioBitrate -FileName -Directory -Year -
Genre -Album -Band -Length -Duration -Directory-Filename -j -r -ext mp3
-ext  flac "C:\Audio" |find /v "ExifToolVersion" >

I'm not sure which one of your examples fits or even where it goes.

Phil Harvey

OK.  The Filter option is probably easiest.  Just add the option I mentioned in technique 3 to your command.  Anywhere is fine, except between -ext and its argument.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tlm2408

Thank you very much Phil. That works great!!!