黑白群晖激活AME(Advanced Media Extention)

  [复制链接]
查看6061 | 回复10 | 2024-7-24 11:10:35 | 显示全部楼层 |阅读模式

登录网站,浏览更多精彩内容

您需要 登录 才可以下载或查看,没有账号?加入我们

×
首先进入系统吧AdvacedMediaExtensions要安装上

一、什么是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?
————————————————
DSM7.1
  1. import hashlib
  2. import os
  3. import subprocess

  4. r = ['669066909066906690', 'B801000000', '30']
  5. s = [(0x1F28, 0), (0x48F5, 1), (0x4921, 1), (0x4953, 1), (0x4975, 1), (0x9AC8, 2)]

  6. prefix = '/var/packages/CodecPack/target/usr'
  7. so = prefix + '/lib/libsynoame-license.so'

  8. print("Patching")
  9. with open(so, 'r+b') as fh:
  10.     full = fh.read()
  11.     if hashlib.md5(full).digest().hex() != 'fcc1084f4eadcf5855e6e8494fb79e23':
  12.         print("MD5 mismatch")
  13.         exit(1)
  14.     for x in s:
  15.         fh.seek(x[0] + 0x8000, 0)
  16.         fh.write(bytes.fromhex(r[x[1]]))

  17. lic = '/usr/syno/etc/license/data/ame/offline_license.json'
  18. os.makedirs(os.path.dirname(lic), exist_ok=True)
  19. with open(lic, 'w') as licf:
  20.     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}]')

  21. subprocess.run(['/usr/syno/etc/rc.sysv/apparmor.sh', 'remove_packages_profile', '0', 'CodecPack'])

  22. apparmor = '/var/packages/CodecPack/target/apparmor'
  23. if os.path.exists(apparmor):
  24.     os.rename(apparmor, apparmor + ".bak")

  25. print("Checking whether patch is successful...")
  26. ret = os.system(prefix + "/bin/synoame-bin-check-license")
  27. if ret == 0:
  28.     print("Successful, updating codecs...")
  29.     os.system(prefix + "/bin/synoame-bin-auto-install-needed-codec")
  30.     print("Done")
  31. else:
  32.     print(f"Patch is unsuccessful, retcode = {ret}")
复制代码
DSM7.2
  1. import hashlib
  2. import os
  3. import subprocess

  4. r = ['669066909066906690', 'B801000000', '30']
  5. s = [(0x3718, 0), (0x60A5, 1), (0x60D1, 1), (0x6111, 1), (0x6137, 1), (0xB5F0, 2)]

  6. prefix = '/var/packages/CodecPack/target/usr'
  7. so = prefix + '/lib/libsynoame-license.so'

  8. print("Patching")
  9. with open(so, 'r+b') as fh:
  10.     full = fh.read()
  11.     if hashlib.md5(full).digest().hex() != '09e3adeafe85b353c9427d93ef0185e9':
  12.         print("MD5 mismatch")
  13.         exit(1)
  14.     for x in s:
  15.         fh.seek(x[0] + 0x8000, 0)
  16.         fh.write(bytes.fromhex(r[x[1]]))

  17. lic = '/usr/syno/etc/license/data/ame/offline_license.json'
  18. os.makedirs(os.path.dirname(lic), exist_ok=True)
  19. with open(lic, 'w') as licf:
  20.     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"}]')

  21. subprocess.run(['/usr/syno/etc/rc.sysv/apparmor.sh', 'remove_packages_profile', '0', 'CodecPack'])

  22. apparmor = '/var/packages/CodecPack/target/apparmor'
  23. if os.path.exists(apparmor):
  24.     os.rename(apparmor, apparmor + ".bak")

  25. print("Checking whether patch is successful...")
  26. ret = os.system(prefix + "/bin/synoame-bin-check-license")
  27. if ret == 0:
  28.     print("Successful, updating codecs...")
  29.     os.system(prefix + "/bin/synoame-bin-auto-install-needed-codec")
  30.     print("Done")
  31. else:
  32.     print(f"Patch is unsuccessful, retcode = {ret}")
复制代码
三、运行脚本获取并安装AME

运行刚刚创建的脚本,如果出现权限问题,则打开管理员权限

  1. $ sudo su
  2. password:****
  3. # python ame.py
复制代码

ame是你保存的py的名字随意哈

代码解释

游客,如果您要查看本帖隐藏内容请回复

最后效果图:

1.png



                     
----python代码----------

12python.rar (1.83 KB, 下载次数: 6)
中国领先的数字技术资源交流中心!
西渡欧阳锋 | 2024-7-24 11:28:02 来自手机 | 显示全部楼层
支持一下
中国领先的数字技术资源交流中心!
回复

使用道具 举报

无名(帮) | 2024-7-24 20:57:38 来自手机 | 显示全部楼层
中国领先的数字技术资源交流中心!
回复

使用道具 举报

无名(帮) | 2024-7-26 21:24:40 来自手机 | 显示全部楼层
很好
中国领先的数字技术资源交流中心!
回复

使用道具 举报

hustkuro | 2024-8-11 11:35:40 | 显示全部楼层
看看,谢谢群主
中国领先的数字技术资源交流中心!
flypighd | 2024-8-11 20:52:27 来自手机 | 显示全部楼层
是直接运行py吗
中国领先的数字技术资源交流中心!
北极孤星的泪 | 2024-8-14 16:26:07 | 显示全部楼层

不行要加 一个    环境   python
商乾电商学院,中国最大的电商资源交流基地!
立人 | 2024-8-21 22:27:58 | 显示全部楼层
中国领先的数字技术资源交流中心!
回复

使用道具 举报

chenjf81 | 2024-8-25 21:25:27 | 显示全部楼层
洗白这么简单啊,不用人民币?
中国领先的数字技术资源交流中心!
A278455036 | 2024-9-21 21:24:25 来自手机 | 显示全部楼层
好东西
中国领先的数字技术资源交流中心!
回复

使用道具 举报

1658

主题

40

回帖

2万

积分

官方团队

积分
20739
学费
4750