无损音频ape flac wav mp3的检测方法

2022年10月24日

原创内容,转载请注明出处:https://www.myzhenai.com.cn/post/4239.html

如果大家留意网络上一些无损音质音频文件的话,都离不开ape、flac、wav几种,mp3格式的有时候也有高音质的文件,特别是比特率达到320K、采样率48000的音频音质,都算是无损或是接近无损的音质了。

我们检测这些无损音质音频文件的方法是使用ffmpeg里的媒体检测模块ffprobe.exe,在下载或编译ffmpeg的时候,bin目录下会生成三个程序,1、是ffmpeg.exe,这个是编解码程序,2、是ffprobe.exe,这个是媒体检测程序,3、ffplaye.exe,这是媒体播放程序。

D:\ffmpeg\bin\ffprobe.exe -help
#帮助信息 查询ffprobe.exe所有用法

首先我们来看一看一个ape格式的文件的检测信息。

D:\ffmpeg\bin\ffprobe.exe -of json -show_format -show_streams D:\yisheng.ape
#使用json显示所返回的文件信息
#-show_format、-show_streams可以搜索相关注释

Input #0, ape, from 'D:\yisheng.ape':
  Metadata:
    Album           : 齊天周大聖之西遊雙記
    Album artist    : Various
    Artist          : 卢冠廷
    COMMENT         : 163 key(Don't modify):6YURAByiRHQ6CI5tvtxzQg==
    Genre           : Soundtrack
    Title           : 一生所爱
    Track           : 6/11
    Year            : 1999
  Duration: 00:04:33.67, start: 0.000000, bitrate: 719 kb/s
    Stream #0:0: Audio: ape (APE  / 0x20455041), 44100 Hz, stereo, s16p
    "streams": [
        {
            "index": 0,
            "codec_name": "ape",
            "codec_long_name": "Monkey's Audio",
            "codec_type": "audio",
            "codec_time_base": "1/44100",
            "codec_tag_string": "APE ",
            "codec_tag": "0x20455041",
            "sample_fmt": "s16p",
            "sample_rate": "44100",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/44100",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 12068700,
            "duration": "273.666667",
            "nb_frames": "164",
            "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": "D:\\yisheng.ape",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "ape",
        "format_long_name": "Monkey's Audio",
        "start_time": "0.000000",
        "duration": "273.666667",
        "size": "24617763",
        "bit_rate": "719642",
        "probe_score": 100,
        "tags": {
            "Album": "榻婂ぉ鍛ㄥぇ鑱栦箣瑗块亰闆欒",
            "Album artist": "Various",
            "Artist": "鍗㈠啝寤?,
            "COMMENT": "163 key(Don't modify):6YURAByiRHQ6CI5tvtxzQg==",
            "Genre": "Soundtrack",
            "Title": "涓€鐢熸墍鐖?,
            "Track": "6/11",
            "Year": "1999"
        }
    }
}
PS D:\>

我们可以看到,音频采样率是44100hz,这个就是无损音质的标准了。

D:\ffmpeg\bin\ffprobe.exe -of json -show_format -show_streams D:\tingwen.flac
#检测flac格式的文件

Input #0, flac, from 'D:\tingwen.flac':
  Metadata:
    ALBUM           : 听闻远方有你
    ARTIST          : 刘艺 雯
    TITLE           : 听闻远方有你
  Duration: 00:04:19.47, start: 0.000000, bitrate: 942 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 800x800 [SAR 72:72 DAR 1:1], 90k tbr, 9
0k tbn, 90k tbc (attached pic)
    Metadata:
      comment         : Cover (front)
    "streams": [
        {
            "index": 0,
            "codec_name": "flac",
            "codec_long_name": "FLAC (Free Lossless Audio Codec)",
            "codec_type": "audio",
            "codec_time_base": "1/44100",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "sample_fmt": "s16",
            "sample_rate": "44100",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/44100",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 11442513,
            "duration": "259.467415",
            "bits_per_raw_sample": "16",
            "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
            }
        },
        {
            "index": 1,
            "codec_name": "mjpeg",
            "codec_long_name": "Motion JPEG",
            "profile": "Baseline",
            "codec_type": "video",
            "codec_time_base": "0/1",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 800,
            "height": 800,
            "coded_width": 800,
            "coded_height": 800,
            "closed_captions": 0,
            "has_b_frames": 0,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "1:1",
            "pix_fmt": "yuvj444p",
            "level": -99,
            "color_range": "pc",
            "color_space": "bt470bg",
            "chroma_location": "center",
            "refs": 1,
            "r_frame_rate": "90000/1",
            "avg_frame_rate": "0/0",
            "time_base": "1/90000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 23352067,
            "duration": "259.467411",
            "bits_per_raw_sample": "8",
            "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": 1,
                "timed_thumbnails": 0
            },
            "tags": {
                "comment": "Cover (front)"
            }
        }
    ],
    "format": {
        "filename": "D:\\tingwen.flac",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "flac",
        "format_long_name": "raw FLAC",
        "start_time": "0.000000",
        "duration": "259.467415",
        "size": "30578900",
        "bit_rate": "942820",
        "probe_score": 100,
        "tags": {
            "ALBUM": "鍚椈杩滄柟鏈変綘",
            "ARTIST": "鍒樿壓 闆?,
            "TITLE": "鍚椈杩滄柟鏈変綘"
        }
    }
}
PS D:\>

上边这个flac格式的文件的采样率也是44100hz

接下来我们看一个高音质的mp3文件的检测信息,这个文件是从某云听歌平台上下载的无损音质文件,但是它却是mp3格式的。

D:\ffmpeg\bin\ffprobe.exe -of json -show_format -show_streams D:\guxiangfengjing.mp3

Input #0, mp3, from 'D:\guxiangfengjing.mp3':
  Metadata:
    genre           : Newage
    encoder         : Lavf56.4.101
    comment         : 163 key(Don't modify):L64FU3W4YxX3ZFTmbZ+8/VcZXal+0oHC6/7jrIQD5RCm3ok4oJqz1rmYIq3fPgZr7oVhFxjFHEpf
Xsx1Vo0FkUTxYwLVHUgpQj0RcSPVDd8icyi9gEvyIV3kemBc/XTTMp/r0k9XpFbMELrX1Rq06MZN6OV9ZHzm13DArU7sD/xtUX433smIIMoYEoS1xhdC/6IB
tfiULFAi9LmBRvmyaT4giJqztMUu+JHGWPVEO
    album           : Kidou 木道
    title           : 故郷の原风景
    artist          : 宗次郎
    disc            : 1
    track           : 1
    date            : 1997
  Duration: 00:04:42.75, start: 0.025056, bitrate: 338 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
    Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 640x640 [SAR 72:72 DAR 1:1], 90k tbr, 9
0k tbn, 90k tbc (attached pic)
    Metadata:
      comment         : Media (e.g. label side of CD)
    "streams": [
        {
            "index": 0,
            "codec_name": "mp3",
            "codec_long_name": "MP3 (MPEG audio layer 3)",
            "codec_type": "audio",
            "codec_time_base": "1/44100",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "sample_fmt": "fltp",
            "sample_rate": "44100",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/14112000",
            "start_pts": 353600,
            "start_time": "0.025057",
            "duration_ts": 3990159360,
            "duration": "282.749388",
            "bit_rate": "320000",
            "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
            }
        },
        {
            "index": 1,
            "codec_name": "mjpeg",
            "codec_long_name": "Motion JPEG",
            "profile": "Baseline",
            "codec_type": "video",
            "codec_time_base": "0/1",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 640,
            "height": 640,
            "coded_width": 640,
            "coded_height": 640,
            "closed_captions": 0,
            "has_b_frames": 0,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "1:1",
            "pix_fmt": "yuvj444p",
            "level": -99,
            "color_range": "pc",
            "color_space": "bt470bg",
            "chroma_location": "center",
            "refs": 1,
            "r_frame_rate": "90000/1",
            "avg_frame_rate": "0/0",
            "time_base": "1/90000",
            "start_pts": 2255,
            "start_time": "0.025056",
            "duration_ts": 25447445,
            "duration": "282.749389",
            "bits_per_raw_sample": "8",
            "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": 1,
                "timed_thumbnails": 0
            },
            "tags": {
                "comment": "Media (e.g. label side of CD)"
            }
        }
    ],
    "format": {
        "filename": "D:\\guxiangfengjing.mp3",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mp3",
        "format_long_name": "MP2/3 (MPEG audio layer 2/3)",
        "start_time": "0.025056",
        "duration": "282.749388",
        "size": "11976986",
        "bit_rate": "338872",
        "probe_score": 51,
        "tags": {
            "genre": "Newage",
            "encoder": "Lavf56.4.101",
            "comment": "163 key(Don't modify):L64FU3W4YxX3ZFTmbZ+8/VcZXal+0oHC6/7jrIQD5RCm3ok4oJqz1rmYIq3fPgZr7oVhFxjFHE
pfXsx1Vo0FkUTxYwLVHUgpQj0RcSPVDd8icyi9gEvyIV3kemBc/XTTMp/r0k9XpFbMELrX1Rq06MZN6OV9ZHzm13DArU7sD/xtUX433smIIMoYEoS1xhdC/6
IBtfiULFAi9LmBRvmyaT4giJqztMUu+JHGWPVEOCH9toFWVNES9chRg9hR0047PwDY7mRGbuJGvDRn2LnmJsy9brN3O9OG31cR8m6nc0d+nH6kVEqHdxBLhf
XW3pIEzl9NWazcbywoS+OyWdjG9KojjAdCuWnMdlKS7I5o5rCwv8bRpNMntguTnwEX99GznRe4XaIJkzvoB7cutJHHltHE5ZtUm/TCVCsrzX9phCuAp+hXNC
9B89E5O/pyVBkI95pUv+gIqUUfxcePdBzyWZS7tZh/+DR+8/ZGhkwKPMbl1OcrMT3tzvhSf3GCcF/u7b8cQdI8quSJAZ02VcS4zA==",
            "album": "Kidou 鏈ㄩ亾",
            "title": "鏁呴兎銇師椋庢櫙",
            "artist": "瀹楁閮?,
            "disc": "1",
            "track": "1",
            "date": "1997"
        }
    }
}
PS D:\>

如果大家仔细看,可以看出来里边的一些信息是符合我们无损音质文件的特征的,采样率44100、比特率320k等。

下边这个wav文件是华为Mate手机的电话录音机录制的,但是它也是符合无损音质的一些特征的。

D:\ffmpeg\bin\ffprobe.exe -of json -show_format -show_streams D:\dianhua.wav


Input #0, wav, from 'D:\dianhua.wav':
  Duration: 00:10:51.82, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
    "streams": [
        {
            "index": 0,
            "codec_name": "pcm_s16le",
            "codec_long_name": "PCM signed 16-bit little-endian",
            "codec_type": "audio",
            "codec_time_base": "1/44100",
            "codec_tag_string": "[1][0][0][0]",
            "codec_tag": "0x0001",
            "sample_fmt": "s16",
            "sample_rate": "44100",
            "channels": 2,
            "bits_per_sample": 16,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/44100",
            "duration_ts": 28745240,
            "duration": "651.819501",
            "bit_rate": "1411200",
            "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": "D:\\dianhua.wav",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "wav",
        "format_long_name": "WAV / WAVE (Waveform Audio)",
        "duration": "651.819501",
        "size": "114981006",
        "bit_rate": "1411200",
        "probe_score": 99
    }
}
PS D:\>

所以,一般我们分析音频文件是否是无损音质的时候,不光是需要分辨它的文件格式,我们还需要分析它的编解码信息和一些比特率、采样率等。


sicnature ---------------------------------------------------------------------
Your current IP address is: 204.236.220.47
Your IP address location: 美国弗吉尼亚阿什本
Your IP address country and region: 美国 美国
Your current browser is:
Your current system is:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source https://www.myzhenai.com/post/4239.html

没有评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注