You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改ffprobe命令仅输出JSON结果中的采样率字段值?

ffprobe仅输出音频采样率的修改方法

原命令

你当前查询FLAC文件全量流信息的命令为:
ffprobe -hide_banner -loglevel panic -show_streams -of json 01e8adee-b0f9-4569-a5f5-b2d69d1f7088.flac
执行后会返回包含index、codec_name、sample_rate、channels、duration等全量字段的streams数组JSON。

直接输出纯采样率数值的修改命令

如果不需要任何多余格式、仅返回采样率的纯数值(比如44100、48000、96000这类结果),使用如下命令即可:
ffprobe -hide_banner -loglevel panic -select_streams a:0 -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1 01e8adee-b0f9-4569-a5f5-b2d69d1f7088.flac

参数解释

  • -select_streams a:0:锁定文件内的第一个音频流,避免多音轨文件返回多余结果
  • -show_entries stream=sample_rate:指定只提取流属性中的sample_rate字段,不再拉取其他无关属性
  • -of default=noprint_wrappers=1:nokey=1:调整输出格式为纯值模式,不打印字段名、不输出JSON结构包裹,直接返回字段取值

保留JSON格式仅保留sample_rate字段的命令

如果你需要保留JSON输出格式、只过滤掉其他无关字段,使用如下命令:
ffprobe -hide_banner -loglevel panic -select_streams a:0 -show_entries stream=sample_rate -of json 01e8adee-b0f9-4569-a5f5-b2d69d1f7088.flac
返回结果会保留标准JSON结构,streams数组内仅包含sample_rate字段。

内容的提问来源于stack exchange,提问作者Zahid M Shaikh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.20 16:15:48