【问题标题】:how can set variables from ffprobe如何从 ffprobe 设置变量
【发布时间】:2020-07-24 11:35:52
【问题描述】:

如何将艺术家标题日期等添加到变量中?

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。

问候

【问题讨论】:

  • 你试过dir(metadata)吗?这应该会给你一些关于可用方法和属性的提示。
  • 很遗憾我不知道该怎么做,你能告诉我怎么做吗?

标签: python python-3.x ffprobe


【解决方案1】:

通过阅读source,您看到的元数据in the repr 是一个实例属性metadatawhich is a dict。所以以获取标题为例:

metadata.metadata['title']

【讨论】:

    猜你喜欢
    • 2014-08-09
    • 2017-11-13
    • 2015-07-06
    • 2011-05-08
    • 2013-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多