Files

93 lines
7.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# baji-v2-a01 运行格式参考
快照依据:`lan-voice-android` commit `34b16130463de82d5b750b2c3ee1a4e835805379` 的生产parser;完整来源指南为同仓库 `docs/ANIMATION_ASSET_PRODUCTION_PIPELINE.md`。这份参考随skill携带,脱离仓库仍可阅读;实际接入时核对目标源码,不假定快照永远最新。
## 适用边界
这是baji App特定profile,不是任意角色运行时通用schema。当前identity与packId固定;换肖像也不能自行改identity期待parser支持多角色。新的exact index需要独立接入授权;旧correct-03准入例外不适用于新SHA。资产生产者不修改App或gateway准入来让自己候选通过。
当前支持会话schema2和两段音乐dance;用户的新要求是无音轨纯action。后者需parser、player、ActionController、模型枚举和gateway能力扩展。无声媒体可以测量和审核,完成App接入前标 `unsupported_by_current_contract`。不得补AAC、伪audioEndUs或伪装旧舞蹈。
## Shape、时间和资源上限
| 项目 | 当前要求 |
|---|---|
| shape | 480×848或720×1280,同index的body/桥/action统一;新生产默认720×1280 |
| fps | 默认24,parser支持有理fps1..60;N和PTS取最终解码结果 |
| body/桥时序 | N2..720,duration0.1..30s,PTS从0严格递增且末PTS<duration |
| 时序一致性 | duration与N×nominal period差≤1period+2us;相邻PTS及末帧到end间隔≤2period+2us |
| state | 2..60曲线帧,100..1000ms,独立fps/PTS/N,alpha有限且0..1 |
| patch | RGBA8 straight/unassociated,width/height1..128,坐标在实际body像素范围内 |
| 内存 | 每runtime decoded RGBA≤8,000,000 bytes;所有会话+桥≤32,000,000 bytes |
| 图 | conversation packages1..12,edges≤100;非fallback有fallback双向路径 |
| payload | 运行引用≤512,000,000 bytes;body/桥video≤64,000,000 bytes,PNG≤256,000 bytes |
N97@24的最后PTS可能4,000,000而duration为4,041,667us。不要把97、25或193当通用固定N。ffprobe与声明比较容差通常2us,manifest内patch.ptsUs与body.ptsUs必须精确一致。
## Runtime字段
每个会话/桥runtime有:
- `schemaVersion:2`、`identityId:a01`、`packId:a01-expression-action-v1-<package-or-edge-id>-runtime-04`。
- `publishApproval:false`;`runtimeReady`按真实技术状态填写。默认检查要求true;显式用户debug候选可以false但入口绑定特定exact parent SHA,不能泛用。
- `body:{path,sha256,width,height,frameCount,durationUs,fpsNumerator,fpsDenominator,ptsUs,hasAudio:false}`。path为 `body/<safe-name>.mp4`,视频只有一个正常H264流。
- `patchFormat:{format:"PNG RGBA 8bit",alphaEncoding:"straight_unassociated",bodySha256,apertureLevels:[0,0.25,0.5,0.75,1],requiresRendererExtension:true}`。
- `patches`恰好N条,顺序 `frameIndex=i`、`ptsUs=body.ptsUs[i]`,附 `x/y/width/height/levels`。
- `levels`顺序0..4,每个含 `levelIndex/aperture/path/sha256`。所有N×5路径唯一,path为 `patches/<safe-name>.png`,位图大小匹配该帧声明。
- 顶层patch `path/sha256`可一并省略;若出现,必须同时出现且精确等于levels[4]。
- `mouthStates`包含idle/opening/talk1/talk2/end-talk完整五种;`stateRouting`按下面固定路由。
每state有 `id/frameCount/fpsNumerator/fpsDenominator/durationMs/ptsUs/globalAlphaByFrame/entryMouthAnchor/exitMouthAnchor`。`frameCount==ptsUs.length==globalAlphaByFrame.length`,不等同body N。
| state | mouth anchor | alpha | 常用参考 |
|---|---|---|---|
| idle | A→A | 全0 | 12帧500ms@24 |
| opening | A→B | 首0末1 | 6帧250ms@24 |
| talk1 / talk2 | B→B | 首末1,中间min<.5 | 各12帧500ms@24 |
| end-talk | B→A | 首1末0 | 6帧250ms@24 |
```json
{
"idle": ["idle", "opening"],
"opening": ["talk1", "talk2", "end-talk"],
"talk1": ["talk1", "talk2", "end-talk"],
"talk2": ["talk1", "talk2", "end-talk"],
"end-talk": ["idle"]
}
```
五档表示开口几何,不是opacity。L0绕过patch、L1..4选择最近档、选中档global opacity1;空间alpha做边缘融合。坐标在每段实际body上独立跟踪,不能复用neutral数据或统一乘1.5。身体frameclock与mouthstateclock独立。
## Index、桥与引用
index字段:`schemaVersion:2/identityId:a01/packId:a01-expression-action-v1/fallbackPackageId/conversationPackages/edges/actions/files`,并记录revision、review和来源状态。
conversation row:`id/emotion/visualIntensity/mouthBodySha256/runtimeManifest:{path,sha256}/entryAnchor/exitAnchor/legalExitFrames/loopEdge`。emotion只支持neutral/happy/sad;neutral intensity0,happy/sad intensity1。fallback是neutral。entry/exit身体锚点当前均A。
edge:`id/from/to/fromAnchor/toAnchor/fromFrame/toFrame/fromPtsUs/toPtsUs/clip`。clip提供相对path、SHA、实际shape/N/PTS/fps/duration、hasAudio:false。源frame在legalExitFrames内,源/目标PTS精确等于对应body帧。
nativeLoop:true仅同包last→0,clip与自身body SHA/PTS/duration一致;复用已有嘴层。非native会话桥附 `mouthRuntimeManifest:{path,sha256}`及 `mouthAllowed:true`,runtime的body SHA/N/PTS/fps/duration/shape与clip完全一致,N×5使用桥自身数据。无mouth桥只能silent-only,不能当完整live TALK图。
index `files`列出交付文件的相对path、SHA256、bytes;运行引用必须都在inventory,review可列入但不可自动打进APK。无绝对路径、URL、`.`、`..`或symlink逃逸。runtime SHA先算,index后写,index自身SHA外置。
## Action候选与运行目标
新无声候选独立交:kind意图、asset/variant ID、H264单视频流文件、测量报告、`sourcePackageId/sourceFrame/sourcePtsUs/returnPackageId/returnFrame/returnPtsUs`、原速和接缝预览。以实际fallback锚点绑定,`hasAudio:false`;不捏造audioEndUs。
target播放合同:TTS真实drained、录音真实停止确认、合法neutral入口、ACTION独占、视频真实end/release、回锚点、completed一次,再可发言。mouthAllowed:false/disallowTALK:true只禁止外叠嘴与讲话,视频原有自然笑容或张嘴可保留。
## 目标仓库可用时的实际checker
从目标repo根目录执行,evidence需新建且在owner源目录之外;这些命令不导入不发布:
```sh
python3 scripts/check-avatar-runtime.py --manifest <runtime>/manifest.json \
--sha256 <actual-runtime-sha> --output logs/asset-production/<fresh>.json
python3 scripts/package-avatar-emotion.py --manifest <candidate>/manifest.json \
--sha256 <actual-index-sha> --output logs/asset-production/<fresh-dir>
python3 scripts/diagnose-avatar-candidate.py --manifest <candidate>/manifest.json \
--sha256 <actual-index-sha> --output logs/asset-production/<fresh-reject-dir>
```
现有脚本含原环境路径,迁移执行前由代码owner适配本地工具入口;不要因为python脚本在文件夹就宣称它可跨环境运行。当前checker拒绝新无声action或尚未授权的新candidate时如实保留原因,不调整审核flag或生成假媒体。skill的本地media audit只测媒体,不替代这些生产checks。