| 43 | multi_binding = True # 支持多实例,每实例使用不同的转码参数 |
| 44 | |
| 45 | def params(self) -> dict: |
| 46 | return { |
| 47 | "ffmpeg_cmd": { |
| 48 | "type": "str", |
| 49 | "description": ( |
| 50 | "FFmpeg 命令行参数,支持变量:{vhost} {app} {stream}," |
| 51 | "例如:-i rtsp://localhost:554/{app}/{stream} -c:v libx264 -c:a aac -f flv rtmp://localhost/live/{stream}_transcoded" |
| 52 | ), |
| 53 | "default": "", |
| 54 | }, |
| 55 | "vhost_filter": { |
| 56 | "type": "str", |
| 57 | "description": "来源 vhost 过滤,支持通配符 *,默认匹配所有", |
| 58 | "default": "*", |
| 59 | }, |
| 60 | "app_filter": { |
| 61 | "type": "str", |
| 62 | "description": "来源 app 过滤,支持通配符 *,默认匹配所有", |
| 63 | "default": "*", |
| 64 | }, |
| 65 | "stream_filter": { |
| 66 | "type": "str", |
| 67 | "description": "来源 stream 过滤,支持通配符 *,默认匹配所有", |
| 68 | "default": "*", |
| 69 | }, |
| 70 | "schema_filter": { |
| 71 | "type": "str", |
| 72 | "description": ( |
| 73 | "只对指定来源协议触发,多个用英文逗号分隔," |
| 74 | "例如 rtsp,rtmp。空则匹配所有协议。" |
| 75 | ), |
| 76 | "default": "", |
| 77 | }, |
| 78 | } |
| 79 | |
| 80 | def run(self, **kwargs) -> bool: |
| 81 | is_register: bool = kwargs.get("is_register", False) |