gpt4 book ai didi

video - 获取 MOV 视频的元数据

转载 作者:行者123 更新时间:2023-11-28 21:42:00 28 4
gpt4 key购买 nike

我有一个 .MOV 视频由电话信使应用程序发送。能否找回文件和作者的真实创作数据?我尝试使用 ffprobe、mediainfo 和类似工具,但只给我下载日期。

最佳答案

所以,我更新了MMM's code到 Python3 并改进了一些东西。

def get_mov_timestamps(filename):
''' Get the creation and modification date-time from .mov metadata.

Returns None if a value is not available.
'''
from datetime import datetime as DateTime
import struct

ATOM_HEADER_SIZE = 8
# difference between Unix epoch and QuickTime epoch, in seconds
EPOCH_ADJUSTER = 2082844800

creation_time = modification_time = None

# search for moov item
with open(filename, "rb") as f:
while True:
atom_header = f.read(ATOM_HEADER_SIZE)
#~ print('atom header:', atom_header) # debug purposes
if atom_header[4:8] == b'moov':
break # found
else:
atom_size = struct.unpack('>I', atom_header[0:4])[0]
f.seek(atom_size - 8, 1)

# found 'moov', look for 'mvhd' and timestamps
atom_header = f.read(ATOM_HEADER_SIZE)
if atom_header[4:8] == b'cmov':
raise RuntimeError('moov atom is compressed')
elif atom_header[4:8] != b'mvhd':
raise RuntimeError('expected to find "mvhd" header.')
else:
f.seek(4, 1)
creation_time = struct.unpack('>I', f.read(4))[0] - EPOCH_ADJUSTER
creation_time = DateTime.fromtimestamp(creation_time)
if creation_time.year < 1990: # invalid or censored data
creation_time = None

modification_time = struct.unpack('>I', f.read(4))[0] - EPOCH_ADJUSTER
modification_time = DateTime.fromtimestamp(modification_time)
if modification_time.year < 1990: # invalid or censored data
modification_time = None

return creation_time, modification_time

和...

你不知道吗,就在我完成时,我发现了如何使用 exiftool 来完成它,我用它来处理 .jpg 文件的类似任务。 :-/

⏵ exiftool -time:all img_3904.mov

关于video - 获取 MOV 视频的元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21355316/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com