使用ffprobe获取音频信息(JSON格式)
发布日期:2021-06-29 11:52:48
浏览次数:2
分类:技术文章
本文共 3623 字,大约阅读时间需要 12 分钟。
用ffmpeg中ffprobe以JSON格式获取音频信息
在外部程序调用并处理音频视频信息时,通过ffmpeg/ffprobe查看音频视频文件信息并输出为json格式是非常实用的功能,在终端输入以下命令:
ffprobe -v quiet -print_format json -show_format -show_streams #{ source}
#{source}部分替换为mp3文件所在路径。输出如下:
{ "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": "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/14112000", "start_pts": 353600, "start_time": "0.025057", "duration_ts": 3346145280, "duration": "237.113469", "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 }, "tags": { "encoder": "LAME3.99r" }, "side_data_list": [ { "side_data_type": "Replay Gain" } ] }, { "index": 1, "codec_name": "mjpeg", "codec_long_name": "Motion JPEG", "codec_type": "video", "codec_time_base": "0/1", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 500, "height": 500, "coded_width": 500, "coded_height": 500, "has_b_frames": 0, "sample_aspect_ratio": "0:1", "display_aspect_ratio": "0: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": 21340212, "duration": "237.113467", "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": "/Users/mac123/Desktop/music/张学友 - 吻别 (摇滚版).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": "237.113469", "size": "3864162", "bit_rate": "130373", "probe_score": 51, "tags": { "ID": "7063568", "title": "吻别 (摇滚版)", "artist": "张学友", "album": "Jacky cheung 15", "genre": "Blues" } }}
转载地址:https://blog.csdn.net/zzl819954692/article/details/80832936 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
第一次来,支持一个
[***.219.124.196]2024年04月20日 12时59分13秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
又一国产开源微内核操作系统上线!源代码已开放下载
2019-04-29
10年老兵!从大学毕业生到嵌入式系统工程师的修炼之道……
2019-04-29
如何才能学好单片机?
2019-04-29
一根网线有这么多“花样”,你知道吗?
2019-04-29
雷军1994年写的诗一样的代码,我把它运行起来了!
2019-04-29
2020年大学生电子设计竞赛,B题,单相在线式不间断电源,详细技术方案!
2019-04-29
大佬终于把鸿蒙OS讲明白了,收藏了!
2019-04-29
C语言指针,这可能是史上最干最全的讲解啦(附代码)!!!
2019-04-29
国内大陆有哪些芯片公司处于世界前10?一起看看!
2019-04-29
单精度、双精度、多精度和混合精度计算的区别是什么?
2019-04-29
中国35位“大国工匠”榜单出炉!西工大、西电合计占半壁江山!清华仅1人!...
2019-04-29
知乎热议:嵌入式开发中C++好用吗?
2019-04-29
2020,Python 已死?
2019-04-29
漫画:程序员相亲?哈哈哈哈哈哈
2019-04-29
30种EMC标准电路分享,再不收藏就晚了!
2019-04-29
这100道Linux常见面试题,看看你会多少?
2019-04-29
十年硬件老司机,结合实际案例,带你探索单片机低功耗设计!
2019-04-29
“2020年嵌入式软件秋招经验和对嵌入式软件未来的一点思考”
2019-04-29
嵌入式的坑在哪方面?
2019-04-29
三种常见嵌入式设备通信协议
2019-04-29