大德米 Windows 专用 - 视频制作与发布神器 PowerShell 版本 最后更新:2026-03-15
CLI-Anything 是一个革命性的框架,让 AI 能够通过命令行控制本地软件。
# 进入工作目录
cd C:\Users\$env:USERNAME\.openclaw\workspace
# 克隆 CLI-Anything 仓库
git clone https://github.com/simonw/cli-anything.git CLI-Anything
# 或从指定源克隆(如果有特定版本)
# git clone https://github.com/特定源/cli-anything.git CLI-Anything
# 进入仓库目录
cd C:\Users\$env:USERNAME\.openclaw\workspace\CLI-Anything
# 检查 Python 版本(需要 3.10+)
python --version
# 安装依赖
pip install -r requirements.txt
# 或安装可编辑模式(开发用)
pip install -e .
# 检查安装
python -c "import cli_anything; print('CLI-Anything installed')"
# 查看帮助
python -m cli_anything --help
需求:将一批视频统一转码为 1080p + 添加水印
# 创建批量转码脚本
$script = @'
# 批量转码配置
$inputDir = "C:\Users\$env:USERNAME\Videos\Input"
$outputDir = "C:\Users\$env:USERNAME\Videos\Output"
$watermark = "C:\Users\$env:USERNAME\Videos\watermark.png"
# 确保输出目录存在
New-Item -ItemType Directory -Path $outputDir -Force | Out-Null
# 获取所有视频文件
$videos = Get-ChildItem -Path $inputDir -Include "*.mp4","*.mov","*.avi" -Recurse
foreach ($video in $videos) {
$outputFile = Join-Path $outputDir ($video.BaseName + "_1080p.mp4")
Write-Host "Processing: $($video.Name)" -ForegroundColor Cyan
# FFmpeg 命令
$ffmpegArgs = @(
"-i", $video.FullName,
"-i", $watermark,
"-filter_complex", "[0:v]scale=1920:1080[bg];[bg][1:v]overlay=W-w-10:H-h-10",
"-c:v", "libx264",
"-preset", "fast",
"-crf", "23",
"-c:a", "aac",
"-b:a", "128k",
"-y", $outputFile
)
& ffmpeg $ffmpegArgs 2>&1 | Out-Null
Write-Host "✅ Completed: $outputFile" -ForegroundColor Green
}
Write-Host "🎉 All videos processed!" -ForegroundColor Green
'@
# 保存脚本
$scriptPath = "C:\Users\$env:USERNAME\.openclaw\workspace\scripts\batch-transcode.ps1"
$script | Out-File -FilePath $scriptPath -Encoding UTF8
# 执行脚本
& $scriptPath
需求:从长视频中自动剪辑精彩片段
# 使用 FFmpeg 自动剪辑
$script = @'
# 视频剪辑配置
$sourceVideo = "C:\Users\$env:USERNAME\Videos\long-video.mp4"
$clips = @(
@{ Start = "00:00:30"; Duration = "00:00:15"; Name = "intro" },
@{ Start = "00:05:45"; Duration = "00:00:30"; Name = "highlight1" },
@{ Start = "00:12:20"; Duration = "00:00:20"; Name = "highlight2" }
)
$outputDir = "C:\Users\$env:USERNAME\Videos\Clips"
New-Item -ItemType Directory -Path $outputDir -Force | Out-Null
foreach ($clip in $clips) {
$outputFile = Join-Path $outputDir "$($clip.Name).mp4"
Write-Host "Cutting clip: $($clip.Name)" -ForegroundColor Cyan
$ffmpegArgs = @(
"-ss", $clip.Start,
"-t", $clip.Duration,
"-i", $sourceVideo,
"-c:v", "copy",
"-c:a", "copy",
"-y", $outputFile
)
& ffmpeg $ffmpegArgs 2>&1 | Out-Null
Write-Host "✅ Clip saved: $outputFile" -ForegroundColor Green
}
Write-Host "🎬 All clips created!" -ForegroundColor Green
'@
$scriptPath = "C:\Users\$env:USERNAME\.openclaw\workspace\scripts\auto-clip.ps1"
$script | Out-File -FilePath $scriptPath -Encoding UTF8
& $scriptPath
# 批量生成视频缩略图
$script = @'
$videoDir = "C:\Users\$env:USERNAME\Videos\Output"
$thumbDir = "C:\Users\$env:USERNAME\Videos\Thumbnails"
New-Item -ItemType Directory -Path $thumbDir -Force | Out-Null
$videos = Get-ChildItem -Path $videoDir -Filter "*.mp4"
foreach ($video in $videos) {
$thumbFile = Join-Path $thumbDir ($video.BaseName + ".jpg")
# 在视频 10% 处截取一帧
$ffmpegArgs = @(
"-ss", "00:00:05",
"-i", $video.FullName,
"-vframes", "1",
"-q:v", "2",
"-y", $thumbFile
)
& ffmpeg $ffmpegArgs 2>&1 | Out-Null
Write-Host "🖼️ Thumbnail: $thumbFile" -ForegroundColor Green
}
'@
& $script
# 使用 YouTube Data API 自动上传
# 需要先配置 API 密钥和 OAuth 凭证
$script = @'
# YouTube 上传配置
$videoFile = "C:\Users\$env:USERNAME\Videos\Output\final-video.mp4"
$title = "医疗旅游攻略:如何在中国节省 80% 医疗费用"
$description = @"
在这个视频中,我们将详细介绍如何在中国接受高质量医疗服务,同时节省高达 80% 的费用。
时间戳:
00:00 - 介绍
01:30 - 为什么选择中国
03:45 - 费用对比
05:20 - 如何选择医院
07:00 - 签证和行程
相关链接:
网站:https://chinahospitalsguide.com
联系:contact@chinahospitalsguide.com
"@
$tags = @("医疗旅游", "中国医院", "节省医疗费用", "海外就医")
$category = "Education"
# 调用 YouTube 上传脚本(需要提前安装 google-api-python-client)
# 注意:这需要 YouTube API 凭证
Write-Host "📤 Uploading to YouTube..." -ForegroundColor Cyan
Write-Host "Title: $title" -ForegroundColor Gray
# 这里调用实际的 YouTube 上传命令
# python upload_to_youtube.py --file "$videoFile" --title "$title" --description "$description"
Write-Host "✅ Upload complete!" -ForegroundColor Green
'@
# 实际执行需要 YouTube API 配置
# Bilibili 上传(使用 bilibili-uploader 工具)
$script = @'
# Bilibili 上传配置
$config = @{
VideoFile = "C:\Users\$env:USERNAME\Videos\Output\final-video.mp4"
Title = "【医疗旅游】在中国看病能省多少钱?真实案例分享"
Description = @"
大家好,这期视频分享医疗旅游的真实经历
本视频包含:
• 中国医院排名
• 费用对比(美国 vs 中国)
• 签证办理流程
• 患者真实故事
如果觉得有帮助,请点赞、收藏、转发!
#医疗旅游 #中国医院 #海外就医
"@
Tags = @("医疗", "旅游", "医院", "海外")
Copyright = 1 # 原创
Tid = 202 # 分区:生活-其他
}
Write-Host "📤 Uploading to Bilibili..." -ForegroundColor Cyan
# 调用 Bilibili 上传
# & bilibili-uploader -c $config
Write-Host "✅ Bilibili upload complete!" -ForegroundColor Green
'@
# 一键发布到多个平台
$script = @'
param(
[string]$VideoFile = "C:\Users\$env:USERNAME\Videos\Output\final-video.mp4",
[string]$Title = "医疗旅游攻略",
[string]$Description = "详细医疗旅游指南"
)
$platforms = @(
@{ Name = "YouTube"; Enabled = $true },
@{ Name = "Bilibili"; Enabled = $true },
@{ Name = "TikTok"; Enabled = $false }, # 需要竖屏视频
@{ Name = "Xiaohongshu"; Enabled = $false } # 需要特殊格式
)
foreach ($platform in $platforms) {
if ($platform.Enabled) {
Write-Host "📤 Publishing to $($platform.Name)..." -ForegroundColor Cyan
switch ($platform.Name) {
"YouTube" {
# & python upload_youtube.py --file $VideoFile --title $Title
Write-Host " YouTube upload simulated" -ForegroundColor Gray
}
"Bilibili" {
# & bilibili-uploader --file $VideoFile --title $Title
Write-Host " Bilibili upload simulated" -ForegroundColor Gray
}
}
Write-Host " ✅ $($platform.Name) done" -ForegroundColor Green
}
}
Write-Host "🎉 Multi-platform publish complete!" -ForegroundColor Green
'@
$scriptPath = "C:\Users\$env:USERNAME\.openclaw\workspace\scripts\multi-publish.ps1"
$script | Out-File -FilePath $scriptPath -Encoding UTF8
# 使用示例
# & $scriptPath -VideoFile "video.mp4" -Title "标题" -Description "描述"
# 为特定软件创建 CLI 接口
# 以 FFmpeg 为例
$cliDefinition = @'
{
"name": "video-tools",
"version": "1.0.0",
"commands": {
"transcode": {
"description": "转码视频",
"args": {
"input": { "type": "string", "required": true },
"output": { "type": "string", "required": true },
"resolution": { "type": "string", "default": "1080p" }
}
},
"thumbnail": {
"description": "生成缩略图",
"args": {
"input": { "type": "string", "required": true },
"time": { "type": "string", "default": "00:00:05" }
}
},
"concat": {
"description": "合并视频",
"args": {
"inputs": { "type": "array", "required": true },
"output": { "type": "string", "required": true }
}
}
}
}
'@
# 保存 CLI 定义
$configPath = "C:\Users\$env:USERNAME\.openclaw\workspace\CLI-Anything\video-tools.json"
$cliDefinition | Out-File -FilePath $configPath -Encoding UTF8
Write-Host "✅ CLI definition created: $configPath" -ForegroundColor Green
# 创建 OpenClaw 可调用的脚本
$wrapper = @'
# OpenClaw Video Tools Wrapper
param(
[Parameter(Mandatory=$true)]
[ValidateSet("transcode", "thumbnail", "concat")]
[string]$Action,
[Parameter(Mandatory=$true)]
[string]$Input,
[string]$Output,
[string]$Resolution = "1080p"
)
switch ($Action) {
"transcode" {
Write-Host "🎬 Transcoding $Input to $Resolution..." -ForegroundColor Cyan
# FFmpeg 命令
& ffmpeg -i $Input -vf "scale=-1:$($Resolution -replace 'p','')" -c:v libx264 -preset fast -y $Output
}
"thumbnail" {
Write-Host "🖼️ Generating thumbnail for $Input..." -ForegroundColor Cyan
$outputFile = if ($Output) { $Output } else { "$Input.jpg" }
& ffmpeg -ss 00:00:05 -i $Input -vframes 1 -q:v 2 -y $outputFile
}
}
Write-Host "✅ Done!" -ForegroundColor Green
'@
$wrapperPath = "C:\Users\$env:USERNAME\.openclaw\workspace\scripts\video-tools.ps1"
$wrapper | Out-File -FilePath $wrapperPath -Encoding UTF8
# 使用示例
# & $wrapperPath -Action transcode -Input "video.mp4" -Output "out.mp4" -Resolution 1080p
# 完整的视频制作自动化脚本
$workflow = @'
# 医疗旅游视频制作自动化
param(
[string]$Topic = "心脏手术费用对比",
[string]$RawFootageDir = "C:\Users\$env:USERNAME\Videos\Raw",
[string]$OutputDir = "C:\Users\$env:USERNAME\Videos\Published"
)
Write-Host "🎬 Starting video production workflow..." -ForegroundColor Cyan
Write-Host "Topic: $Topic" -ForegroundColor Gray
# 1. 素材整理
Write-Host "`n📁 Step 1: Organizing footage..." -ForegroundColor Yellow
$clips = Get-ChildItem -Path $RawFootageDir -Filter "*.mp4"
Write-Host "Found $($clips.Count) clips"
# 2. 批量转码
Write-Host "`n🎞️ Step 2: Transcoding..." -ForegroundColor Yellow
$transcodedDir = Join-Path $OutputDir "Transcoded"
New-Item -ItemType Directory -Path $transcodedDir -Force | Out-Null
foreach ($clip in $clips) {
$output = Join-Path $transcodedDir $clip.Name
& ffmpeg -i $clip.FullName -vf "scale=1920:1080" -c:v libx264 -preset fast -y $output 2>&1 | Out-Null
}
Write-Host "✅ Transcoding complete"
# 3. 添加水印
Write-Host "`n🏷️ Step 3: Adding watermark..." -ForegroundColor Yellow
$watermarkedDir = Join-Path $OutputDir "Watermarked"
New-Item -ItemType Directory -Path $watermarkedDir -Force | Out-Null
$watermark = "C:\Users\$env:USERNAME\Videos\Assets\logo.png"
foreach ($clip in Get-ChildItem -Path $transcodedDir -Filter "*.mp4") {
$output = Join-Path $watermarkedDir $clip.Name
& ffmpeg -i $clip.FullName -i $watermark -filter_complex "[0:v][1:v]overlay=W-w-10:H-h-10" -c:a copy -y $output 2>&1 | Out-Null
}
Write-Host "✅ Watermark added"
# 4. 生成缩略图
Write-Host "`n🖼️ Step 4: Generating thumbnails..." -ForegroundColor Yellow
$thumbDir = Join-Path $OutputDir "Thumbnails"
New-Item -ItemType Directory -Path $thumbDir -Force | Out-Null
foreach ($clip in Get-ChildItem -Path $watermarkedDir -Filter "*.mp4") {
$thumb = Join-Path $thumbDir ($clip.BaseName + ".jpg")
& ffmpeg -ss 00:00:10 -i $clip.FullName -vframes 1 -q:v 2 -y $thumb 2>&1 | Out-Null
}
Write-Host "✅ Thumbnails generated"
# 5. 准备发布
Write-Host "`n📤 Step 5: Ready for publishing!" -ForegroundColor Green
Write-Host "Output files:" -ForegroundColor Gray
Write-Host " Videos: $watermarkedDir"
Write-Host " Thumbnails: $thumbDir"
# 生成发布清单
$publishList = Join-Path $OutputDir "publish-list.txt"
@"
发布清单 - $Topic
生成时间: $(Get-Date)
视频文件:
$((Get-ChildItem -Path $watermarkedDir | ForEach-Object { "- $($_.Name)" }) -join "`n")
缩略图:
$((Get-ChildItem -Path $thumbDir | ForEach-Object { "- $($_.Name)" }) -join "`n")
下一步:
1. 上传到 YouTube
2. 上传到 Bilibili
3. 更新网站链接
"@ | Out-File -FilePath $publishList -Encoding UTF8
Write-Host "`n🎉 Workflow complete! Check $publishList" -ForegroundColor Green
'@
$workflowPath = "C:\Users\$env:USERNAME\.openclaw\workspace\scripts\video-production-workflow.ps1"
$workflow | Out-File -FilePath $workflowPath -Encoding UTF8
Write-Host "✅ Video production workflow created!" -ForegroundColor Green
Write-Host "Run with: .\video-production-workflow.ps1 -Topic 'Your Topic'" -ForegroundColor Gray
# 视频转码
ffmpeg -i input.mp4 -vf "scale=1920:1080" -c:v libx264 output.mp4
# 提取音频
ffmpeg -i video.mp4 -vn -acodec copy audio.aac
# 合并视频
ffmpeg -f concat -i filelist.txt -c copy output.mp4
# 添加字幕
ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt" output.mp4
# 调整速度
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" output.mp4 # 2x speed
# 生成 GIF
ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1:flags=lanczos" output.gif
CLI-Anything 让视频制作从手工劳动变成自动化流程!
大德米 Windows 专用 PowerShell 版本 最后更新:2026-03-15