黑群晖激活Advanced Media Extensions(AME)解码HEVC视频和HEIC图片
声明:此教程在正版群晖系统中进行的操作,虽然也能用于非正版系统中AME的安装,但是在非正版系统中安装AME属于破解行为,对系统造成的影响和其它方面的影响由个人负责,如有实力请支持正版群晖。
DSM的Advanced Media Extensions套件必须要登录群晖账号才能激活使用,导致黑群晖在使用Video Station或者Synology Photos等套件时,无法查看高效率视频编码 (HEVC) 和高效率图像容器 (HEIC) 文件。今天就来说说黑群晖如何通过补丁激活AME。
一、什么是Advanced Media Extensions?
其功能是:支持在群晖DSM上查看高效率视频编码 (HEVC) 和高效率图像容器 (HEIC) 文件
激活后可在不同套件中实现:
- File Station
- Synology Drive
- Surveillance Station
- Synology MailPlus
- Synology Mail Plus Server
- Synology Photos
- Universal Viewer
- Video Station
二、如何激活AME?
说明:通过补丁激活AME属破解行为,该教程仅用于个人学习,不得用于商业行为,后果自负。有实力请支持群晖(本人黑白群晖都使用,最开始用的黑群晖,后来觉得不错入手了正品,感谢群晖对个人爱好者的支持与包容)
一、通过ssh连接到群晖
二、在tmp下创建一个py脚本
- 创建脚本,touch ame.py
- 使用vim在脚本中输入以下代码:
DSM7.1
import hashlib
import os
import subprocess
r = ['669066909066906690', 'B801000000', '30']
s = [(0x1F28, 0), (0x48F5, 1), (0x4921, 1), (0x4953, 1), (0x4975, 1), (0x9AC8, 2)]
prefix = '/var/packages/CodecPack/target/usr'
so = prefix + '/lib/libsynoame-license.so'
print("Patching")
with open(so, 'r+b') as fh:
full = fh.read()
if hashlib.md5(full).digest().hex() != 'fcc1084f4eadcf5855e6e8494fb79e23':
print("MD5 mismatch")
exit(1)
for x in s:
fh.seek(x[0] + 0x8000, 0)
fh.write(bytes.fromhex(r[x[1]]))
lic = '/usr/syno/etc/license/data/ame/offline_license.json'
os.makedirs(os.path.dirname(lic), exist_ok=True)
with open(lic, 'w') as licf:
licf.write('[{"appType": 14, "appName": "ame", "follow": ["device"], "server_time": 1666000000, "registered_at": 1651000000, "expireTime": 0, "status": "valid", "firstActTime": 1651000001, "extension_gid": null, "licenseCode": "0", "duration": 1576800000, "attribute": {"codec": "hevc", "type": "free"}, "licenseContent": 1}, {"appType": 14, "appName": "ame", "follow": ["device"], "server_time": 1666000000, "registered_at": 1651000000, "expireTime": 0, "status": "valid", "firstActTime": 1651000001, "extension_gid": null, "licenseCode": "0", "duration": 1576800000, "attribute": {"codec": "aac", "type": "free"}, "licenseContent": 1}]')
subprocess.run(['/usr/syno/etc/rc.sysv/apparmor.sh', 'remove_packages_profile', '0', 'CodecPack'])
apparmor = '/var/packages/CodecPack/target/apparmor'
if os.path.exists(apparmor):
os.rename(apparmor, apparmor + ".bak")
print("Checking whether patch is successful...")
ret = os.system(prefix + "/bin/synoame-bin-check-license")
if ret == 0:
print("Successful, updating codecs...")
os.system(prefix + "/bin/synoame-bin-auto-install-needed-codec")
print("Done")
else:
print(f"Patch is unsuccessful, retcode = {ret}")
DSM7.2
import hashlib
import os
import subprocess
r = ['669066909066906690', 'B801000000', '30']
s = [(0x3718, 0), (0x60A5, 1), (0x60D1, 1), (0x6111, 1), (0x6137, 1), (0xB5F0, 2)]
prefix = '/var/packages/CodecPack/target/usr'
so = prefix + '/lib/libsynoame-license.so'
print("Patching")
with open(so, 'r+b') as fh:
full = fh.read()
if hashlib.md5(full).digest().hex() != '09e3adeafe85b353c9427d93ef0185e9':
print("MD5 mismatch")
exit(1)
for x in s:
fh.seek(x[0] + 0x8000, 0)
fh.write(bytes.fromhex(r[x[1]]))
lic = '/usr/syno/etc/license/data/ame/offline_license.json'
os.makedirs(os.path.dirname(lic), exist_ok=True)
with open(lic, 'w') as licf:
licf.write('[{"attribute": {"codec": "hevc", "type": "free"}, "status": "valid", "extension_gid": null, "expireTime": 0, "appName": "ame", "follow": ["device"], "duration": 1576800000, "appType": 14, "licenseContent": 1, "registered_at": 1649315995, "server_time": 1685421618, "firstActTime": 1649315995, "licenseCode": "0"}, {"attribute": {"codec": "aac", "type": "free"}, "status": "valid", "extension_gid": null, "expireTime": 0, "appName": "ame", "follow": ["device"], "duration": 1576800000, "appType": 14, "licenseContent": 1, "registered_at": 1649315995, "server_time": 1685421618, "firstActTime": 1649315995, "licenseCode": "0"}]')
subprocess.run(['/usr/syno/etc/rc.sysv/apparmor.sh', 'remove_packages_profile', '0', 'CodecPack'])
apparmor = '/var/packages/CodecPack/target/apparmor'
if os.path.exists(apparmor):
os.rename(apparmor, apparmor + ".bak")
print("Checking whether patch is successful...")
ret = os.system(prefix + "/bin/synoame-bin-check-license")
if ret == 0:
print("Successful, updating codecs...")
os.system(prefix + "/bin/synoame-bin-auto-install-needed-codec")
print("Done")
else:
print(f"Patch is unsuccessful, retcode = {ret}")
三、运行脚本获取并安装AME
运行刚刚创建的脚本,如果出现权限问题,则打开管理员权限
$ sudo su
password:****
# python ame.py
- 最后看到done即完成安装ame