如何从 ffprobe 设置变量
how can set variables from ffprobe
如何将艺术家名称日期等添加到变量中?
from ffprobe import FFProbe
metadata = FFProbe("01-leo_lausemaus_-_leo_lausemaus_titelsong.mp3")
print(metadata)
输出结果其:
<FFprobe: {'title': 'Leo Lausemaus Titelsong', 'artist': 'Leo Lausemaus', 'track': '1/0', 'album': 'Folge 1', 'disc': '1', 'date': '2015', 'TLEN': '78', 'album_artist': 'Leo Lausemaus', 'Duration': '00:01:18.99', 'start': '0.025056', 'bitrate': '329 kb/s'}, [<Stream: #1 [video] Motion JPEG, 0, (512x512)>], [<Stream: #0 [audio] MP3 (MPEG audio layer 3), channels: 2 (stereo), 44100Hz> ], [], []>
我希望能够单独输出每个变量
我在 windows 上使用 python 3.8。
此致
来自阅读source, the metadata you're seeing in the repr is an instance attribute, metadata
, which is a dict。所以要获得标题例如:
metadata.metadata['title']
如何将艺术家名称日期等添加到变量中?
from ffprobe import FFProbe
metadata = FFProbe("01-leo_lausemaus_-_leo_lausemaus_titelsong.mp3")
print(metadata)
输出结果其:
<FFprobe: {'title': 'Leo Lausemaus Titelsong', 'artist': 'Leo Lausemaus', 'track': '1/0', 'album': 'Folge 1', 'disc': '1', 'date': '2015', 'TLEN': '78', 'album_artist': 'Leo Lausemaus', 'Duration': '00:01:18.99', 'start': '0.025056', 'bitrate': '329 kb/s'}, [<Stream: #1 [video] Motion JPEG, 0, (512x512)>], [<Stream: #0 [audio] MP3 (MPEG audio layer 3), channels: 2 (stereo), 44100Hz> ], [], []>
我希望能够单独输出每个变量
我在 windows 上使用 python 3.8。
此致
来自阅读source, the metadata you're seeing in the repr is an instance attribute, metadata
, which is a dict。所以要获得标题例如:
metadata.metadata['title']