---
title: 回调函数格式
description: "回调函数用于接收VideoDecoder解码后的数据（如Image数据、frameId等）并在回调函数内实现自定义处理功能。"
url: https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/latest/Application%20Development%20Guide/msadg/mxvisionug_1139.html
sourcePath: /source/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application Development Guide/msadg/mxvisionug_1139.html
indexId: 9f31be5793027839ad871bf3300763003ccc80e7e3593db5cda9b75e810be61e102
---
# 回调函数格式

#### 功能说明

回调函数用于接收VideoDecoder解码后的数据（如Image数据、frameId等）并在回调函数内实现自定义处理功能。

用户如需实现自定义处理功能，建议进行简单的操作，如数据保存、列表写入（append），降低函数处理耗时，防止解码线程阻塞，导致视频解码速度变慢。


#### 函数原型

```
def callback_func(decodedImage: Image, channelId: int, frameId: int) -> None
```


#### 参数说明

callback_func为函数名称，用户可自己定义，与registerVdecCallBack注册的函数名一致即可。

| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| decodedImage | Image类 | 解码后输出的图像类。 |
| channelId | int | 视频流索引，在VideoDecoder类初始化设置。 |
| frameId | int | 视频帧索引，由VideoDecoder类的decode函数来设置。 |


#### 抛异常接口

未按指定格式定义的函数参数及输出，抛出“pybind11::error_already_set”异常。
