【发布时间】:2016-08-16 02:20:53
【问题描述】:
我有一个程序必须根据单独的 json 文件中的数据编辑多个视频。这些视频是连续的,它们在自己的 json 文件中有元数据。程序使用逐帧叠加(眼动追踪数据)对其进行编辑。
我想做的是将单个 mp4 元数据与 json 文件元数据进行比较,这样我就可以比较时间戳,确保一切都是同步的。
如果可能,我将如何获取 mp4 元数据?
【问题讨论】:
标签: python json opencv video ffmpeg
我有一个程序必须根据单独的 json 文件中的数据编辑多个视频。这些视频是连续的,它们在自己的 json 文件中有元数据。程序使用逐帧叠加(眼动追踪数据)对其进行编辑。
我想做的是将单个 mp4 元数据与 json 文件元数据进行比较,这样我就可以比较时间戳,确保一切都是同步的。
如果可能,我将如何获取 mp4 元数据?
【问题讨论】:
标签: python json opencv video ffmpeg
您可以为此使用mp4file 模块。
pip install mp4file
from mp4file.mp4file import Mp4File
def find_metadata_atom(file, name):
atom = file.find('.//%s//data' % name)
return atom.get_attribute('data')
file = Mp4File("bill.mp4")
title = find_metadata_atom(file, 'title')
tvshow = find_metadata_atom(file, 'tvsh')
【讨论】:
ModuleNotFoundError: No module named 'atom' 如果我安装 atom,我得到:ImportError: cannot import name 'parse_atoms' from 'atom' (/home/rolf/.local/lib/python3.8/site-packages/atom/__init__.py)