使用ffprobe 查询wav文件信息

Posted bill-robot

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用ffprobe 查询wav文件信息相关的知识,希望对你有一定的参考价值。

使用ffprobe 查询wav文件信息
安装
安装过程和ffmepg相同不在赘述

不带参数查询文件信息

ffprobe ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav 
ffprobe: /usr/local/lib/libuuid.so.1: no version information available (required by /lib/x86_64-linux-gnu/libblkid.so.1)
ffprobe version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, wav, from 'ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav':
  Duration: 00:00:03.73, bitrate: 128 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, 1 channels, s16, 128 kb/s

去除不必要的日志

ffprobe -loglevel quiet ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav

使用-show_format

ffprobe -loglevel quiet -show_format ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav
[FORMAT]
filename=ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav
nb_streams=1
nb_programs=0
format_name=wav
format_long_name=WAV / WAVE (Waveform Audio)
start_time=N/A
duration=3.730000
size=59724
bit_rate=128094
probe_score=99
[/FORMAT]

使用-print_format json输出为json格式

ffprobe -loglevel quiet -show_format -print_format json  ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav
{
    "format": {
        "filename": "ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "wav",
        "format_long_name": "WAV / WAVE (Waveform Audio)",
        "duration": "3.730000",
        "size": "59724",
        "bit_rate": "128094",
        "probe_score": 99
    }
}

使用 -show_format -show_streams

ffprobe -loglevel quiet -show_format -show_streams -print_format json  ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav
{
    "streams": [
        {
            "index": 0,
            "codec_name": "pcm_s16le",
            "codec_long_name": "PCM signed 16-bit little-endian",
            "codec_type": "audio",
            "codec_time_base": "1/8000",
            "codec_tag_string": "[1][0][0][0]",
            "codec_tag": "0x0001",
            "sample_fmt": "s16",
            "sample_rate": "8000",
            "channels": 1,
            "bits_per_sample": 16,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/8000",
            "duration_ts": 29840,
            "duration": "3.730000",
            "bit_rate": "128000",
            "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": "ZH_biaobei_标准合成_甜美女声_楠楠_5_5_5_6_1_4047db9ffe21ffc845816028a9fdd120.wav",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "wav",
        "format_long_name": "WAV / WAVE (Waveform Audio)",
        "duration": "3.730000",
        "size": "59724",
        "bit_rate": "128094",
        "probe_score": 99
    }
}

本文由博客一文多发平台 OpenWrite 发布!

以上是关于使用ffprobe 查询wav文件信息的主要内容,如果未能解决你的问题,请参考以下文章

Android Chaquopy 没有这样的文件或目录:'ffprobe'

为啥将拆分为 wav 文件的旋律转换为拆分的 mp3 会在片段边界处产生不好的声音?

ffmpeg音视频开发: 使用ffprobe获取媒体信息

FFmpeg三件套之FFprobe使用介绍

FFprobe使用指南

如果它尝试播放 mp3 文件,我的代码会崩溃,适用于 wav 文件