
Byted Las Audio Convert
- 31 installs
- 411 repo stars
- Updated August 4, 2026
- bytedance/agentkit-samples
byted-las-audio-convert is a Claude skill that converts and transcodes audio file formats and encoding parameters via the Volcengine LAS service.
About
This skill converts and transcodes audio files between formats such as wav, mp3, flac, m4a, ogg, and aac using Volcengine LAS. A developer points it at a local file or TOS path, and it adjusts sample rate, bitrate, channels, and compression via ffmpeg parameters. It reads duration locally with ffprobe to estimate cost, waits for confirmation, then runs the conversion operator.
- Converts and transcodes audio between wav, mp3, flac, m4a, ogg, aac via Volcengine LAS
- Adjusts sample rate, bitrate, and channels through ffmpeg extra_params
- Estimates cost with ffprobe duration before running
Byted Las Audio Convert by the numbers
- 31 all-time installs (skills.sh)
- Ranked #964 of 1,335 Generative Media skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
byted-las-audio-convert capabilities & compatibility
Requires a Volcengine LAS account (LAS_API_KEY); billed per-run, estimated before execution (billing per Volcengine LAS pricing)
- Capabilities
- audio conversion · transcoding · resampling
- Works with
- openai
- Runs
- Runs locally
- Pricing
- Bring your own API key
What byted-las-audio-convert says it does
Converts and transcodes audio file formats and encoding parameters using Volcengine LAS.
lasutil process las_audio_convert "$data" > "$workdir/result.json"
**环境变量**: `LAS_API_KEY` (必填)
npx skills add https://github.com/bytedance/agentkit-samples --skill byted-las-audio-convertAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 31 |
|---|---|
| repo stars | ★ 411 |
| Last updated | August 4, 2026 |
| Repository | bytedance/agentkit-samples ↗ |
What it does
Convert or transcode audio between formats and adjust sample rate, bitrate, and channels via Volcengine LAS.
Who is it for?
Audio format conversion and transcoding (wav/mp3/flac/m4a/ogg/aac) with sample-rate, bitrate, and channel adjustment via Volcengine LAS.
When should I use this skill?
A user wants to convert an audio format, resample, adjust bitrate/channels, or preprocess audio.
What you get
A converted audio file in the target format with adjusted encoding parameters.
- converted audio file
By the numbers
- design pattern: Tool Wrapper + Pipeline
- 5-step workflow plus Step 0 pre-check
- supports 6+ audio formats (wav/mp3/flac/m4a/ogg/aac)
Files
LAS 音频格式转换(las_audio_convert)
将 TOS 上的音频文件转换为指定格式(wav/mp3/flac),可通过 extra_params 传入 ffmpeg 参数调整采样率、声道数等。
设计模式
本 skill 主要采用:
- Tool Wrapper:封装
lasutilCLI 调用 - Pipeline:包含 Step 0 → Step N 的顺序工作流
核心 API 与配置
- 算子 ID:
las_audio_convert - API: 同步(
process) - 环境变量:
LAS_API_KEY(必填)
详细参数与接口定义见 references/api.md。
Gotchas
- 密钥安全:若聊天框屏蔽密钥,让用户在当前目录创建
env.sh并写入export LAS_API_KEY="...",SDK 会自动读取。 - 免责声明:最终回复结果时必须包含:"本方式的计费均为预估计费,与实际费用有差距,实际费用以运行后火山产生的账单为准。计费说明请参考 Volcengine LAS 定价。",且禁止使用"实际费用"字眼描述预估价。
工作流(严格按步骤执行)
复制此清单并跟踪进度:
执行进度:
- [ ] Step 0: 前置检查
- [ ] Step 1: 初始化与准备
- [ ] Step 2: 预估价格
- [ ] Step 3: 执行/提交任务
- [ ] Step 4: 结果呈现Step 0: 前置检查(⚠️ 必须在第一轮对话中完成)
在接受用户的任务后,不要立即开始执行,必须首先进行以下环境检查: 1. 检查 `LAS_API_KEY` 与 `LAS_REGION`:确认环境变量或 .env 中是否已配置。
- 若无,必须立即向用户索要(提示:
LAS_REGION常见为cn-beijing)。 - 注意:
LAS_REGION必须与您的 API Key 及 TOS Bucket 所在的地域完全一致。如果用户中途切换了 Region,必须提醒用户其 TOS Bucket 也需对应更换,否则会导致权限异常或上传失败。
2. 检查输入路径:
- 如果用户要求处理的是本地文件,则需要先通过 File API 上传至 TOS(只需
LAS_API_KEY,无需额外 TOS 凭证)。 - 如果算子的输出结果存放在 TOS 上,且用户需要下载回本地,则需要
VOLCENGINE_ACCESS_KEY和VOLCENGINE_SECRET_KEY。对于仅需要上传输入文件的场景,TOS 凭证不再必须。
3. 确认无误后:才能进入下一步。
Step 1: 初始化与准备
环境初始化(Agent 必做):
# 执行统一的环境初始化与更新脚本(会自动创建/激活虚拟环境,并检查更新)
source "$(dirname "$0")/scripts/env_init.sh" las_audio_convert
workdir=$LAS_WORKDIR如果网络问题导致更新失败,脚本会跳过检查,使用本地已安装的 SDK 继续执行。
- 处理本地文件时:先本地检查格式和时长,预估价格,用户确认后再上传:
# 提前检查容器格式(避免参数错误)
./scripts/check_format.sh <local_path>
# 本地使用 ffprobe 获取时长(无需上传即可预估价格)
duration_sec=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:noprint_section=1 <local_path>)计算预估价格并等待用户确认后,再执行上传:
# 用户确认后,上传到 TOS
lasutil file-upload <local_path>上传成功后返回 JSON,取其中的 tos_uri(格式 tos://bucket/key)传给算子作为输入路径。
Step 2: 预估价格(⚠️ 必须获得用户确认)
1. 读取 references/prices.md 获取最新计费标准。 2. 优先本地获取时长(避免不必要上传):
# 使用 ffprobe 本地获取
duration_sec=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:noprint_section=1 <local_path>)如果 ffprobe 失败,再使用 lasutil 远程获取:
lasutil media-duration <input_audio_url>3. 根据时长和模型单价计算总价,将计费单价与预估总价一并告知用户并强制暂停执行,明确等待用户回复确认。在用户明确回复"继续"、"确认"等同意指令前,绝对禁止进入下一步(执行/提交任务)。提示:预估仅供参考,实际以火山账单为准。计费说明请参考 Volcengine LAS 定价。
Step 3: 执行转换 (Process)
构造基础 data.json(仅需必填项,高级用法可在其中加 "extra_params": ["-ar", "44100", "-ac", "1"]):
{
"input_path": "<presigned_url>",
"output_path": "tos://bucket/output.wav",
"output_format": "wav"
}执行命令:
data=$(cat "$workdir/data.json")
lasutil process las_audio_convert "$data" > "$workdir/result.json"结果呈现
使用脚本自动生成结果展示(自动包含计费声明):
./scripts/generate_result.md.sh $workdir/result.json <estimated_price>生成内容包含:
- 任务信息卡片
- 自动生成转换结果表格
- 自动包含计费声明 ✅
手动提取方式:
jq '[.data.audios[] | {
input: (.input_path | split("/") | last),
output: .output_path,
duration: "\(.duration)s",
status: .status
}]' result.json如果 status 为 failed,标记为 ❌ 并提示用户检查输入格式。
审查标准
执行完成后,Agent 应自检: 1. 环境变量是否正确配置 2. 输入文件是否成功上传 3. 输出结果是否正确呈现给用户 4. 计费声明是否包含
byted-las-audio-convert 自检清单(Skill Hub)
- SKILL.md 顶部包含 YAML frontmatter(name/description)
- 文档不包含任何真实密钥、Token、Cookie(只引用
LAS_API_KEY环境变量名) - 文档包含预估价格步骤,且 references/prices.md 提供单价信息
- 推荐流程为 submit + 短轮询 poll,不包含阻塞等待示例
- 批处理示例包含 tos-ls、batch-submit、batch-poll,并强调
--max-seconds以避免 openclaw 阻塞 - 大批量支持在 workdir 下按 batch_001/batch_002 分批隔离 inputs/data/state
- 常见问题包含 openclaw
task_id 为 null、$RANDOM不可用等环境差异 - skill 目录内不包含临时文件(如
__pycache__、.DS_Store、大体积输出文件)
{
"skill_name": "byted-las-audio-convert",
"evals": [
{
"id": 1,
"prompt": "我有一个本地的音频文件 test.mp3,我需要把它转换成 wav 格式,16000 采样率,请帮我完成。",
"expected_output": "包含 las_sdk.file.upload 将文件上传至 TOS 的步骤,然后使用 client.media.process 调用 byted-las-audio-convert 技能,配置 dst_format='wav', dst_sample_rate=16000。"
},
{
"id": 2,
"prompt": "我有一个 TOS 上的音频 tos://my-bucket/audio.m4a,需要将其转换为 2 通道的 mp3 格式并保存到 tos://my-bucket/output.mp3,请给出调用代码。",
"expected_output": "包含调用 client.media.process,配置 dst_format='mp3', dst_channels=2,并直接输入 TOS 路径的示例代码。"
},
{
"id": 3,
"prompt": "如果我需要调整音频的比特率到 128kbps,请问应该在 byted-las-audio-convert 的配置中如何传参?",
"expected_output": "说明需要在调用时设置 dst_bit_rate 参数为 128000 (128kbps) 的代码片段。"
}
]
}# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
las_audio_convert API 参考
Base / Region
- API Base:
https://operator.las.<region>.volces.com/api/v1 - Region:
cn-beijingcn-shanghai
鉴权:Authorization: Bearer $LAS_API_KEY
请求体定义
| 字段名 | 类型 | 是否必选 | 说明 |
|---|---|---|---|
| operator_id | string | 是 | 固定为 las_audio_convert(CLI 自动填充) |
| operator_version | string | 是 | 固定为 v1(CLI 自动填充) |
| data | AudioConvertReqParams | 是 | `data.json` 的内容对应此字段,详情见下表 |
AudioConvertReqParams
| 字段名 | 类型 | 是否必选 | 说明 |
|---|---|---|---|
| input_path | string | 是 | 待转换音频文件的 TOS 地址 (tos://bucket/key) |
| output_path | string | 是 | 转换后音频文件的 TOS 地址 (tos://bucket/key) |
| output_format | string | 否 | 转换目标格式。支持 wav, mp3, flac,默认 wav |
| extra_params | List<string> | 否 | 额外 ffmpeg 参数列表,如 ["-ar", "44100"] |
响应体定义
| 字段名 | 类型 | 备注 |
|---|---|---|
| metadata | metadata | 请求元信息,包含 status, business_code, request_id 等 |
| data | AudioConvertResponse | 返回数据(可能是 JSON 对象或 JSON 字符串) |
AudioConvertResponse
| 字段名 | 类型 | 备注 |
|---|---|---|
| audios | list<Audio> | 转换结果列表 |
Audio
| 名称 | 类型 | 描述 |
|---|---|---|
| input_path | string | 输入路径 |
| output_path | string | 输出路径 |
| duration | float | 音频时长 |
| status | string | 转换状态 (success/failed) |
业务码
| 业务码 | 含义 |
|---|---|
| 0 | 正常返回 |
| 1001 | 通用请求端异常 |
| 1002 | 缺失鉴权请求头 |
| 1003 | API Key 无效 |
| 1004 | 指定的 Operator 无效 |
| 1006 | 请求入参格式有误 |
| 2001 | 通用服务端异常 |
计费信息
- 智能音频转换:0.003 元/分钟
预估方式(元)
- 用
lasutil media-duration <audio_url>获取duration_seconds duration_minutes = duration_seconds / 60estimated_price_yuan = duration_minutes * 0.003
#!/bin/bash
# ==============================================================================
# 音频格式预检查
# Usage: scripts/check_format.sh <file_path>
# ==============================================================================
FILE_PATH="$1"
if [ -z "$FILE_PATH" ]; then
echo "❌ 错误: 请提供文件路径"
exit 1
fi
# 获取文件扩展名并转小写
EXT=$(echo "$FILE_PATH" | awk -F. '{print tolower($NF)}')
# 允许的容器格式
ALLOWED_FORMATS="wav mp3 m4a flac aac ogg"
if [[ " $ALLOWED_FORMATS " =~ " $EXT " ]]; then
echo "✅ 格式检查通过: $EXT (容器格式)"
exit 0
else
echo "⚠️ 警告: 文件扩展名 '$EXT' 可能不是容器格式"
echo " 允许的容器格式: $ALLOWED_FORMATS"
echo " 请确认输入格式参数正确"
exit 1
fi
#!/bin/bash
# ==============================================================================
# LAS SDK & Skill 环境初始化与更新脚本
# 用法: source scripts/env_init.sh <operator_id>
# ==============================================================================
OPERATOR_ID=$1
if [ -z "$OPERATOR_ID" ]; then
echo "❌ 错误: 必须提供 operator_id"
return 1 2>/dev/null || exit 1
fi
# 1. 虚拟环境隔离
# Find project root dynamically, then check for .las_venv
# skill structure: <project_root>/skills/<skill>/scripts/env_init.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
# 优先复用项目根目录的虚拟环境,不存在才创建新的
if [ -d "${PROJECT_ROOT}/.las_venv" ]; then
source "${PROJECT_ROOT}/.las_venv/bin/activate"
elif [ ! -d ".las_venv" ]; then
python3 -m venv .las_venv
source .las_venv/bin/activate
else
source .las_venv/bin/activate
fi
# 2. 获取远程 manifest
manifest_url="https://las-ai-cn-beijing-online.tos-cn-beijing.volces.com/operator_cards_serving/public/skills/sdk/manifest.json"
manifest=$(curl -sf "$manifest_url" || echo '{}')
# 3. 比较 SDK 版本并自动更新
local_ver=$(lasutil --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || echo "0.0.0")
remote_ver=$(echo "$manifest" | jq -r '.sdk_version // "unknown"')
if [ "$local_ver" = "0.0.0" ] || [ "$local_ver" != "$remote_ver" ]; then
echo "📦 SDK 更新: $local_ver → $remote_ver,正在安装..."
pip install --quiet --upgrade https://las-ai-cn-beijing-online.tos-cn-beijing.volces.com/operator_cards_serving/public/skills/sdk/las_sdk-0.2.0-py3-none-any.whl
fi
# 4. 检查当前算子的参数变更
op_changes=$(echo "$manifest" | jq -r ".operators.${OPERATOR_ID}.changes_since // {} | to_entries[] | \" 自 \(.key) 起: \(.value[])\"" 2>/dev/null)
if [ -n "$op_changes" ]; then
echo "⚠️ 算子 ${OPERATOR_ID} 有参数更新:"
echo "$op_changes"
echo "建议使用 find-skills 检索并更新此 skill 到最新版本。"
fi
# 5. 初始化工作目录
export LAS_WORKDIR=$(mktemp -d /tmp/las_work_XXXXXX)
echo "✅ 环境初始化完成,工作目录: $LAS_WORKDIR"
#!/bin/bash
# ==============================================================================
# 生成结果展示 markdown 模板,自动包含计费声明
# Usage: scripts/generate_result.md.sh <result_json> <estimated_price>
# ==============================================================================
RESULT_JSON="$1"
ESTIMATED_PRICE="$2"
if [ -z "$RESULT_JSON" ] || [ ! -f "$RESULT_JSON" ]; then
echo "❌ 错误: 需要提供 result.json 文件路径"
exit 1
fi
cat <<EOF
# 音频转换结果
## 任务信息
- **算子**: \`las_audio_convert\`
EOF
if [ -n "$ESTIMATED_PRICE" ]; then
cat <<EOF
- **预估计费**: ${ESTIMATED_PRICE} 元
EOF
fi
cat <<EOF
## 转换结果
| 输入 | 输出路径 | 时长 | 状态 |
|------|---------|------|------|
EOF
# Extract and print each row
cat "$RESULT_JSON" | jq -r '.data.audios[] |
"| \(.input_path | split("/") | last) | \(.output_path) | \(.duration) | '"\$"' .status |'
EOF
cat <<'EOF'
---
本方式的计费均为预估计费,与实际费用有差距,实际费用以运行后火山产生的账单为准。计费说明请参考 [Volcengine LAS 定价](https://www.volcengine.com/docs/6492/1544808)。
EOF