To add effects, you must first add the effect as a material using d.Content.AddMaterial with Mtype="video_effects", then place it on an effect track using d.Content.Add2Track.
Required keys for AddMaterial (video effects):
apply_target_type: The target type for the effect (e.g., 2).effect_id: The specific ID of the effect.effect_resource_id: The resource ID for the effect.type: Set to "video_effect".
Required keys for Add2Track (effects):
render_index: The rendering order/layer.target_timerange: Defines the duration and start position of the effect on the timeline.
import uuid
effect_name = "蓝色丝印"
effect_resource_id = "7131985730791805448"
effect_id = "4097661"
effect_material_id = str(uuid.uuid3(namespace=uuid.NAMESPACE_DNS, name=effect_name + "_material"))
effect_track_id = str(uuid.uuid3(namespace=uuid.NAMESPACE_DNS, name=effect_name + "_track"))
# 1. Add effect material
d.Content.AddMaterial(Mtype="video_effects", Content={
"apply_target_type": 2,
"effect_id": effect_id,
"id": effect_material_id,
"name": effect_name,
"render_index": 0,
"effect_resource_id": effect_resource_id,
"type": "video_effect",
"value": 1
})
# 2. Add effect to track
d.Content.Add2Track(Track_id=efect_track["id"], Content={
"id": effect_track_id,
"material_id": effect_material_id,
"render_index": 11000,
"speed": 1,
"target_timerange": {
"duration": 500600000,
"start": 0
},
"visible": True,
"volume": 1
})