ffmpeg查看音频文件信息

查看音频文件的信息(基于本地路径)

import subprocess
import json
path = r'D:\learn\download\NosVJ60QCIs0b8PVHMPomZJsrFU2b8eRnuiZp9yz.aac'
command = (r'ffprobe -print_format json -loglevel quiet -show_streams %s'%path)
result = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out = result.stdout.read()
temp = str(out.decode('utf-8'))
print(json.loads(temp))

也可以把本地路径换成文件的url地址

command = ["ffprobe.exe", "-loglevel", "quiet", "-print_format", "json", "-show_format", "-show_streams", "-i",
           r'https://imglive.ehafo.com/course/temp/2019/02/ZlliRoa7fPPgofrGP2okVVBjgh3k43P518sw1AUd.aac']

 

posted @ 2019-02-26 14:26  Leslie-x  阅读(5722)  评论(0编辑  收藏  举报