黑群晖启用Advanced Media Extensions的脚本,解决HEVC/HEIC解码

前言:

从群晖7.0开始,官方对黑群做了一定限制,如未完全洗白是无法使用Advanced Media Extensions,而Advanced Media Extensions又是索引HEVC视频和HEIC照片必须的插件。今天有大神破解了插件,我们一起来学习一下。

教程开始

1、用文本另存下方python代码(命名不限,后缀.py结尾)。

import hashlib
import os

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}]')


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}")

2、将保存的python文件上传至群晖任意目录,复制文件位置备用。

图片[1]-黑群晖启用Advanced Media Extensions的脚本,解决HEVC/HEIC解码-杨公子的博客
复制位置

3、进群晖控制面板,选择计划任务,新增,触发的任务,用户定义的脚本按下列要求添加脚本。

用户账号选择root,定义脚本为:python /volume1/bak/aem.py,其中/volume1/bak/aem.py为刚才上传的脚本地址。

图片[2]-黑群晖启用Advanced Media Extensions的脚本,解决HEVC/HEIC解码-杨公子的博客
选择触发任务,用户自定义脚本。
图片[3]-黑群晖启用Advanced Media Extensions的脚本,解决HEVC/HEIC解码-杨公子的博客
任务名称随意,账号选择root。
图片[4]-黑群晖启用Advanced Media Extensions的脚本,解决HEVC/HEIC解码-杨公子的博客
用户定义脚本为:python空格加刚才复制的脚本位置

4、添加好脚本,右键运行一次脚本,然后打开群晖套件中心,下载Advanced Media Extensions,记得为3.0,本脚本只适用于3.0。安装好后打开Advanced Media Extensions,状态就开始下载更新。

图片[5]-黑群晖启用Advanced Media Extensions的脚本,解决HEVC/HEIC解码-杨公子的博客
如果提示失败,进任务中心手动运行刚才添加的phthon脚本。

5、再进套件中心,打开synology photos套件,进设置重建索引即可。

图片[6]-黑群晖启用Advanced Media Extensions的脚本,解决HEVC/HEIC解码-杨公子的博客
重新索引

脚本来源地址:https://xpenology.com/forum/topic/65643-ame-30-patcher/

备份脚本下载:

附上DSM7.2 Advanced Media Extensions版本3.1.0-3005解锁脚本

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}")
#脚本使用方法,上面代码另存为py文件。
curl 脚本地址 | python

备份脚本下载:

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享
评论 共6条
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片
    • 头像hongpeng0
    • 头像凱文0
    • 头像空空0