Hello,
I have 10.000 mp3 files...Some of the are 2, 3 or 4 times the same song...
I want to check every file that is more than once and keep the one with the best quality...
Is there a software that can give me this information without looking one by one it's properties?
I run mint and in file's properties there is nowhere kbps info....
Thank you!!!
Quality is in the eye of beholder, or the ear in this case
There are many ways to approach this problem of determining properties in .mp3 files. The outputs of several different commands could be used, depending on how one wishes to assess the .mp3 files. In the following example, as a proof of concept, I've chosen to use the bit rate of an .mp3 file, and coded a script to show the bit rates which are produced in the output of the
mediainfo command. Then the user is in a position to grade the .mp3 files accordingly.
Here is a directory with 2 .mp3 files:
Code:
[~]$ ls
linus.mp3 woodstock.mp3
The
mediainfo command has the following output:
Code:
[~]$ mediainfo linus.mp3
General
Complete name : linus.mp3
Format : MPEG Audio
File size : 33.7 KiB
Duration : 4 s 310 ms
Overall bit rate mode : Constant
Overall bit rate : 64.0 kb/s
Audio
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Duration : 4 s 310 ms
Bit rate mode : Constant
Bit rate : 64.0 kb/s
Channel(s) : 1 channel
Sampling rate : 44.1 kHz
Frame rate : 38.281 FPS (1152 SPF)
Compression mode : Lossy
Stream size : 33.7 KiB (100%)
It has bit rate values which can be selected with the following script using the
awk command.
The script is called
kbinfo which has been placed in the PATH so that it can be called by the user like any other command. In this particular case, the script was place in ~/$USER/bin, where the user's executables reside:
Code:
#!/bin/bash
# Check that a directory was provided
if [[ ! -d "$1" ]]; then
echo "Usage: $0 directory"
exit 1
fi
# output kb/s for each .mp3 file in the directory
find $1 -name "*.mp3" -print0 |
while IFS= read -r -d '' i; do
mediainfo "$i" |
awk -F': *' '
/^Complete name[[:space:]]+:/ {printf "%s ", $2}
/^Overall bit rate[[:space:]]+:/ {print $2}
'
done
The
kbinfo command is given executable permissions:
The script finds the .mp3 files in a named directory (which must be supplied), runs a while loop to read each file being subjected to the
mediainfo command where
awk can extract the bit rate values.
Running
kbinfo in the current directory (shown by the dot after the command name) where the .mp3 files live, produces the following:
Code:
[~]$ kbinfo .
woodstock.mp3 131 kb/s
linus.mp3 64.0 kb/s
The output shows the filename and their bit rates.
There's a few cautions that go with this example. It doesn't have robust error checking. It's simple in that it just does the one thing. It doesn't output a graded listing from top to bottom of files with highest to lowest bit rates. It's just a proof of concept sort of thing. To get a graded listing one can add some scripting which I leave for the interested reader.
There are commands other than
mediainfo that can output information that may be relevant. For example:
ffprobe,
mp3info,
exiftool. There may be others I'm not familiar with. It all depends on how one wishes to assess the .mp3 files.