ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Natural6163 on November 22, 2023, 11:07:50 AM

Title: How can I compare using the AvgBitrate size?
Post by: Natural6163 on November 22, 2023, 11:07:50 AM
I want to find video files in a directory with a bitrate greater than 20Mbps. The exiftool command is:
$> exiftool -if '${AvgBitrate} ge "20 Mbps"' -AvgBitrate -g1 -s -ext mp4 -r .

======== ./2019/2019-02-08/VID_20190208_191241.mp4
---- Composite ----
AvgBitrate                      : 9.19 Mbps
======== ./2019/2019-02-09/L1060023.MP4
---- Composite ----
AvgBitrate                      : 27.3 Mbps

But here the comparison is based on numerical size, which is different from the expected results. How can I compare based on the actual average bitrate size?
Title: Re: How can I compare using the AvgBitrate size?
Post by: Phil Harvey on November 22, 2023, 11:17:58 AM
The "ge" operator does a string comparison.  You need a numerical comparison using the numerical value of the tag (append "#" to the tag name):

exiftool -if '${AvgBitrate#} >= 20' -AvgBitrate -g1 -s -ext mp4 -r .

- Phil
Title: Re: How can I compare using the AvgBitrate size?
Post by: Natural6163 on November 22, 2023, 08:02:25 PM
Thank you, it's working now. Can I use Mbps as the unit for numerical comparison?
Title: Re: How can I compare using the AvgBitrate size?
Post by: Phil Harvey on November 22, 2023, 10:36:26 PM
Oh right.  My command would compare with 20 bps.  :P

I would do it like this:

exiftool -if '${AvgBitrate#} >= 20000000' ...

- Phil