Managing a time duration as a filter

Started by datamgmt, August 13, 2024, 08:11:10 AM

Previous topic - Next topic

datamgmt

I am parsing a massive number of .m4a files and want to find any that are longer than 10 minutes (600 seconds)

Every file has a tag 'MediaDuration' populated by MusicBrainz, and the format is HH:MM:SS, so my working assumption was HH*60*60 + MM*60 + SS > 60*10 as a filter in the if column, so I tried:

exiftool -if 'int(substr($MediaDuration,0,2))*60*60 + int(substr($MediaDuration,3,2))*60 + int(substr($MediaDuration,6,2)) > 60*10' -filename -r .
Can anyone please advise me on what I am doing wrong?

greybeard

Hopefully its much easier than that - you should be able to do something like this:

exiftool -if '$MediaDuration# > 600'  -FileName -r .

StarGeek

What is the error returned by exiftool?  What OS are you using?

I don't see anything wrong with the command as long as you are using Mac/Linux. If you're on Windows, swap the quotes and switch to CMD. PowerShell fails with complex exiftool commands such as this.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

datamgmt

Thanks

This did the trick

exiftool -if '$MediaDuration# > 600'  -FileName -r .

For reference, I am on a Mac Studio (Apple Silicon) running macOS Sonoma 14.5