问题描述
可用于查找 mp3 文件比特率的终端命令是什么?
除了 mpg321 -t name.mp3
之外还有其他可用的选项吗?
最佳回答
MediaInfo 是进一步的解决方案(不仅在 mp3 上)。
sudo apt-get install mediainfo
例子:
mediainfo Aphrodite_-_Superman_\(dnb\).mp3 | grep "Bit rate"
输出:
Bit rate mode : Constant
Bit rate : 192 Kbps
另一个例子:
mediainfo Aphrodite_-_Superman_\(dnb\).mp3 | grep 'Bit rate '
另一个输出:
Bit rate : 192 Kbps
通过 mediainfo 以 bps 为单位准确获取音频比特率:
mediainfo --Output='Audio;%BitRate%' '/MY/MEDIA/FILE.MP3'
或以 Kbps 为单位:
mediainfo --Output='Audio;%BitRate/String%' '/MY/MEDIA/FILE.MP3'
次佳回答
简单的说:
file song.mp3
Note:
file
is included with Ubuntu.
对于别名爱好者,请在 ~/.bashrc
文件的末尾插入:
bitrate () {
echo `basename "$1"`: `file "$1" | sed 's/.*, \(.*\)kbps.*/\1/' | tr -d " " ` kbps
}
打开一个新的终端窗口。您现在可以运行以下命令:
bitrate song.mp3
第三种回答
安装 mp3info 包
sudo apt-get install mp3info
找到比特率使用
mp3info -r a -p "%f %r\n" *.mp3
将提供您需要的信息,还有一些其他有用的功能 man mp3info
以获取更多信息
第四种回答
您可以安装包 libimage-exiftool-perl
:
sudo apt-get install libimage-exiftool-perl
然后运行:
exiftool -AudioBitrate GoldLion.mp3
它会输出如下内容:
Audio Bitrate : 192 kbps
第五种回答
最好的信息 by-far 由 ffprobe
(ffmpeg
包的一部分)提供。 mpg123 也不错,但很难 grep 输出,这可能是您要求其他内容的原因。
$ mpg123 -t example.mp3 2>&1 | grep -A1 -E "^MPEG"
MPEG 2.5 L III cbr32 11025 mono
$ ffprobe example.mp3 2>&1 | grep Stream
Stream #0:0: Audio: mp3, 11025 Hz, mono, s16p, 32 kb/s
对于 pro-use,请执行以下操作:
# ffprobe -v quiet -print_format json -show_format -show_streams example.mp3
{
"streams": [
{
"index": 0,
"codec_name": "mp3",
"codec_long_name": "MP3 (MPEG audio layer 3)",
"codec_type": "audio",
"codec_time_base": "1/11025",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"sample_fmt": "s16p",
"sample_rate": "11025",
"channels": 1,
"channel_layout": "mono",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/14112000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 55294344,
"duration": "3.918250",
"bit_rate": "32000",
"disposition": {
"default": 0,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
}
}
],
"format": {
"filename": "example.mp3",
"nb_streams": 1,
"nb_programs": 0,
"format_name": "mp3",
"format_long_name": "MP2/3 (MPEG audio layer 2/3)",
"start_time": "0.000000",
"duration": "3.918250",
"size": "17260",
"bit_rate": "35240",
"probe_score": 51,
"tags": {
"title": "Sound Effects - Female Operatic La 1 - Opera singer sings La.",
"artist": "Download Sound Effects - SoundDogs - AOS",
"album": "http://www.Sounddogs.com",
"track": "0",
"copyright": "(c) 2010 Sounddogs.com, All Rights Reserved",
"genre": "SFX - Humans; Vocalizations",
"comment": "Royalty Free Sound Effects - Sounddogs.com",
"date": "2008"
}
}
}