使用 ffmpeg 获取 mp3 信息的命令?

问题描述 投票:0回答:6

ffmpeg 是否有一个命令可以返回有关 mp3 的信息,例如比特率或采样频率?

bash ffmpeg
6个回答
33
投票

有一个

ffprobe

简单使用:

ffprobe foo.mp3 2>&1 | grep -A1 Duration:

将为您提供输出(不显示任何额外的窗口),例如:

  Duration: 00:03:10.48, start: 0.000000, bitrate: 128 kb/s
    Stream #0.0: Audio: mp3, 22050 Hz, 2 channels, s16, 128 kb/s

27
投票

你可以尝试:

ffmpeg -i filename

1
投票

您还可以使用:

$ mpg123 -t example.mp3 2>&1 | grep -A1 -E "^MPEG"
MPEG 2.5 L III cbr32 11025 mono
  • 注意
    cbr32
    代表 (stream)
    constant bit rate
    ,此处为 32 kbps。
  • 并且
    11025
    采样率

0
投票

“Michał Šrajer”的答案(使用命令

ffmpeg -i foo.mp3 2>&1 | grep -A1 Duration:
)效果很好,但由于 Grep 和 Findstr 命令之间的差异,Windows 用户必须使用 而不是 命令。


0
投票

有一个开源免费的“exiftool”程序可以帮助您,比 ffmpeg 和 ffprobe 更好。

exiftool filename.mp3

因此您可以通过 exiftool 更改一些属性和元数据,例如任何 mp3、jpg、mp4 和许多其他文件格式的旋转、方向和其他属性。


0
投票

MediaInfo - 用于显示有关音频/视频文件信息的命令行实用程序

alok@alok-HP-Pavilion-Laptop-14-dv0xxx:~$ mediainfo -i ~/backup/samsung-f23-20231014/Recordings/Voice\ Recorder/Voice\ 001.m4a 
General
Complete name                            : /home/alok/backup/samsung-f23-20231014/Recordings/Voice Recorder/Voice 001.m4a
Format                                   : MPEG-4
Format profile                           : 3GPP Media Release 4
Codec ID                                 : 3gp4 (isom/3gp4)
File size                                : 130 MiB
Duration                                 : 2 h 19 min
Overall bit rate mode                    : Constant
Overall bit rate                         : 131 kb/s
Performer                                : Galaxy F23 5G
Encoded date                             : UTC 2023-08-25 10:42:59
Tagged date                              : UTC 2023-08-25 10:42:59
ampl                                     : ur
book                                     : bkmk
com.android.version                      : 13

Audio
ID                                       : 1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 h 19 min
Source duration                          : 2 h 19 min
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 1 channel
Channel layout                           : C
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 128 MiB (98%)
Source stream size                       : 128 MiB (98%)
Title                                    : SoundHandle
Language                                 : English
Encoded date                             : UTC 2023-08-25 10:42:59
Tagged date                              : UTC 2023-08-25 10:42:59
mdhd_Duration                            : 8358584
© www.soinside.com 2019 - 2024. All rights reserved.