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

发布于 2024-12-05 03:44:45 字数 47 浏览 1 评论 0 原文

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

Is there a command with ffmpeg that returns information about an mp3 like the bitrate or sampling frequency?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

_畞蕅 2024-12-12 03:44:45

有一个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

There is a ffprobe.

Simple usage:

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

will give you output (without displaying any extra window) like:

  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
旧伤还要旧人安 2024-12-12 03:44:45

你可以尝试:

ffmpeg -i filename

you can try:

ffmpeg -i filename
花落人断肠 2024-12-12 03:44:45

您还可以使用:

$ mpg123 -t example.mp3 2>&1 | grep -A1 -E "^MPEG"
MPEG 2.5 L III cbr32 11025 mono
  • 注意 cbr32 代表(恒定比特率,此处为 32 kbps。
  • 11025采样率

You can also use:

$ mpg123 -t example.mp3 2>&1 | grep -A1 -E "^MPEG"
MPEG 2.5 L III cbr32 11025 mono
  • Notice cbr32 stand for (stream) constant bit rate, here at 32 kbps.
  • And 11025 is the Sample Rate.
怕倦 2024-12-12 03:44:45

“Michał Šrajer”的答案(使用命令 ffmpeg -i foo.mp3 2>&1 | grep -A1 Duration:)效果很好,但 Windows 用户必须使用 而不是 命令,因为 Grep 和 Findstr 命令之间存在差异。

The answer of "Michał Šrajer" (use of command ffmpeg -i foo.mp3 2>&1 | grep -A1 Duration:) works well but the windows users must use <findstr "Duration: Stream"> instead of <grep -A1 Duration:> command, because of differences between Grep and Findstr commands.

我一向站在原地 2024-12-12 03:44:45

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

ffprobe - ffprobe 媒体探测器

alok@alok-HP-Pavilion-Laptop-14-dv0xxx:~$ ffprobe -i ~/backup/samsung-f23-20231014/Recordings/Voice\ Recorder/Voice\ 001.m4a 
ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
  configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/alok/backup/samsung-f23-20231014/Recordings/Voice Recorder/Voice 001.m4a':
  Metadata:
    major_brand     : 3gp4
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2023-08-25T10:42:59.000000Z
    com.android.version: 13
  Duration: 02:19:18.58, start: 0.000000, bitrate: 130 kb/s
  Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2023-08-25T10:42:59.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]

MediaInfo - command line utility to display information about audio/video files

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

ffprobe - ffprobe media prober

alok@alok-HP-Pavilion-Laptop-14-dv0xxx:~$ ffprobe -i ~/backup/samsung-f23-20231014/Recordings/Voice\ Recorder/Voice\ 001.m4a 
ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
  configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/alok/backup/samsung-f23-20231014/Recordings/Voice Recorder/Voice 001.m4a':
  Metadata:
    major_brand     : 3gp4
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2023-08-25T10:42:59.000000Z
    com.android.version: 13
  Duration: 02:19:18.58, start: 0.000000, bitrate: 130 kb/s
  Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2023-08-25T10:42:59.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]
蝶…霜飞 2024-12-12 03:44:45

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

exiftool filename.mp3

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

There is an opensource and free "exiftool" program that can help you, better than ffmpeg and ffprobe.

exiftool filename.mp3

so you can change some properties and metadata by exiftool, such as rotation, orientation and very other properies on any mp3, jpg, mp4 and many other file formats.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文