ExifTool Forum

ExifTool => Newbies => Topic started by: tlm2408 on October 13, 2017, 10:46:44 AM

Title: remove (approx) from duration tag?
Post by: tlm2408 on October 13, 2017, 10:46:44 AM
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
Title: Re: remove (approx) from duration tag?
Post by: Phil Harvey on October 13, 2017, 10:53:08 AM
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
Title: Re: remove (approx) from duration tag?
Post by: tlm2408 on October 13, 2017, 10:58:53 AM
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.
Title: Re: remove (approx) from duration tag?
Post by: Phil Harvey on October 13, 2017, 11:02:11 AM
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
Title: Re: remove (approx) from duration tag?
Post by: tlm2408 on October 13, 2017, 11:06:05 AM
Thank you very much Phil. That works great!!!