我想使用字幕 API。它需要视频文件的第一个和最后一个 64kb 的 md5 哈希值。
我知道如何执行 md5 部分,只是想知道如何获取 128kb 的数据。
Python 给出了 API 的示例,但遗憾的是我不明白它。
#this hash function receives the name of the file and returns the hash code
def get_hash(name):
readsize = 64 * 1024
with open(name, 'rb') as f:
size = os.path.getsize(name)
data = f.read(readsize)
f.seek(-readsize, os.SEEK_END)
data += f.read(readsize)
return hashlib.md5(data).hexdigest()
http://thesubdb.com/api/
任何帮助,将不胜感激。
尝试这样的事情
FileInputStream in = new FileInputStream("d:/1.avi");
byte[] a = new byte[64 * 1024];
in.read(a); //head
long p = in.getChannel().size() - 64 * 1024;
in.getChannel().position(p);
in.read(a); //tail
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)