원클릭으로
wechat-redpocket
将素材加工为微信红包封面资产。视频→扩边羽化视频;图片→封面蒙版+横幅蒙版。当用户说"红包封面"、"处理素材"、"生成封面/横幅"、"视频扩边"时使用。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
将素材加工为微信红包封面资产。视频→扩边羽化视频;图片→封面蒙版+横幅蒙版。当用户说"红包封面"、"处理素材"、"生成封面/横幅"、"视频扩边"时使用。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when user wants to publish markdown articles to their blog at dhpie.com. Triggers on "发布博客", "同步博客", "blog sync", "publish to blog", "发到博客", or mentions dhpie.com publishing.
One-click publish markdown articles with auto-generated illustrations and covers to blog (dhpie.com), WeChat, X Article, and Xiaohongshu cards. Triggers on "发布各个平台", "publish all", "全平台发布", "发布到所有平台", "publish everywhere".
Use when writing in-depth technical articles, tutorials, industry analysis, or product/business model analysis (1000-3000 words) requiring structured bilingual content without personal narrative
Use when writing concise industry insights, product analysis, technical trend observations, or business model commentary (200-500 words) requiring bilingual content without personal experience
Posts content to WeChat Official Account (良博农资微信公众号) via API or Chrome CDP. Supports article posting (文章) with HTML, markdown, or plain text input, and image-text posting (贴图, formerly 图文) with multiple images. Use when user mentions "发布良博农资公众号", "良博农资微信公众号".
Use when writing personal blog posts, project retrospectives, growth reflections, or narrative essays (1000-3000 words) requiring bilingual content with visible thought process and personal experience
| name | wechat-redpocket |
| description | 将素材加工为微信红包封面资产。视频→扩边羽化视频;图片→封面蒙版+横幅蒙版。当用户说"红包封面"、"处理素材"、"生成封面/横幅"、"视频扩边"时使用。 |
将原始视频或图片素材加工为符合微信红包封面平台规范的发布资产。核心能力:
| 参数 | 值 | 说明 |
|---|---|---|
| 目标分辨率 | 958×1278 | 3:4 竖屏比例,H.264 要求偶数宽高 |
| 最大帧率 | 30 fps | 超过 30fps 时在 vf 链末尾加 fps=30 |
| 目标码率 | 3000 kbit/s | -b:v 3000k |
| 音频 | 按需保留或去除 | 用户要求去音频时加 -an,否则保留原音频 |
| 编码器 | H.264 | -c:v libx264 |
| 羽化半径 | 60px | geq alpha 渐变 |
| 模糊强度 | sigma=50 | 扩边背景高斯模糊 |
| 时长控制 | auto-editor 智能变速 | 基于运动检测的智能加速,非均匀加速 |
| 参数 | 值 |
|---|---|
| 画布尺寸 | 1053×1746 |
| 不可编辑区 | x=46→1007, y=115→1650 |
| 不可编辑区尺寸 | 961×1535 |
| 左右边距 | 各 46px(透明) |
| 上边距 | 115px(可见内容) |
| 下边距 | 96px(可见内容) |
| 参数 | 值 |
|---|---|
| 画布尺寸 | 480×384 |
| 不可编辑区 | x=10→470, y=61→312 |
| 不可编辑区尺寸 | 460×251 |
| 左右边距 | 各 10px(透明) |
| 上边距 | 61px(可见内容) |
| 下边距 | 72px(可见内容) |
ffprobe -v quiet -print_format json -show_format -show_streams INPUT.mp4
提取:分辨率、码率、时长、是否有音频、FPS。
ffmpeg -i INPUT.mp4 -vf "cropdetect=24:2:0" -frames:v 30 -f null - 2>&1 | grep cropdetect
如果检测到黑边 (crop 值 ≠ 原始分辨率),在后续管线开头加 crop=W:H:X:Y。
情况 A — 分辨率完全匹配 (958×1278):
ffmpeg -y -i INPUT.mp4 -vf "fps=30" -c:v libx264 -b:v 3000k OUTPUT.mp4
(源帧率 ≤30 时可省略 fps=30)
情况 B — 比例匹配 3:4 但尺寸不同:
ffmpeg -y -i INPUT.mp4 -vf "scale=958:1278,fps=30" -c:v libx264 -b:v 3000k OUTPUT.mp4
情况 C — 比例不匹配 3:4(最常见):
content_w = min(source_w, int(1278 * source_w / source_h)),确保偶数ffmpeg -y -i INPUT.mp4 -filter_complex "
[0:v]crop=CW:CH:CX:CY[cropped];
[cropped]scale=958:1278,gblur=sigma=50[bg];
[cropped]scale=CONTENT_W:1278,format=yuva420p,
geq=lum='lum(X,Y)':cb='cb(X,Y)':cr='cr(X,Y)':
a='if(lt(X,60),X*255/60,if(gt(X,W-60),(W-X)*255/60,255))'
[main];
[bg][main]overlay=(W-w)/2:0
" -c:v libx264 -b:v 3000k OUTPUT.mp4
关键细节:
crop=CW:CH:CX:CY — 仅在 Step 1 检测到黑边时添加,否则去掉此行,直接用 [0:v]CONTENT_W 必须是偶数(H.264 要求),如果计算结果为奇数则 +1 或 -1scale=958:1278 中 958 和 1278 都是偶数-an处理完成后截取首帧和尾帧检查:
ffmpeg -y -i OUTPUT.mp4 -vf "select=eq(n\,0)" -vframes 1 check_first.png
ffmpeg -y -i OUTPUT.mp4 -sseof -0.1 -vframes 1 check_last.png
检查要点:无黑边、羽化过渡自然、扩边模糊正确。
当用户要求缩短时长时,优先使用 auto-editor 进行基于运动检测的智能变速。
方案 A:auto-editor 智能变速(首选)
auto-editor 会在画面运动少的片段自动加速,运动多的片段保持原速,实现自然的时长压缩。
auto-editor OUTPUT.mp4 --margin 1 --edit motion --output OUTPUT_SPEED.mp4
注意事项:
pipx install auto-editor(不要用 pip,系统环境限制)方案 B:均匀加速(auto-editor 不可用时的降级方案)
当 auto-editor 未安装或执行失败时,使用 setpts 滤镜进行均匀加速:
# 计算加速倍率
speed = source_duration / target_duration
# 应用加速(音频同步调整)
ffmpeg -y -i INPUT.mp4 -filter_complex "[0:v]setpts=PTS/SPEED[v];[0:a]atempo=SPEED[a]" -map "[v]" -map "[a]" OUTPUT.mp4
限制:
atempo 滤镜范围:0.5 ≤ speed ≤ 2.0atempo=2.0,atempo=2.0setpts仅当用户明确要求时:
ffmpeg -y -i INPUT.mp4 -c:v copy -an OUTPUT.mp4
from PIL import Image
import numpy as np
src = Image.open("INPUT.png").convert("RGBA")
arr = np.array(src)
alpha = arr[:, :, 3]
print(f"Size: {src.size}, Has transparency: {np.any(alpha < 255)}")
对于有透明通道的图片,自动检测内容分布:
row_has_content = np.any(alpha > 10, axis=1)
col_has_content = np.any(alpha > 10, axis=0)
content_rows = np.where(row_has_content)[0]
content_cols = np.where(col_has_content)[0]
如果图片有多个分离的内容区域(如上下两部分),检测间隔:
diffs = np.diff(content_rows)
if np.max(diffs) > 50: # 存在明显间隔
gap_idx = np.argmax(diffs)
top_region_end = content_rows[gap_idx]
bottom_region_start = content_rows[gap_idx + 1]
TW, TH = 1053, 1746
# 将内容缩放适配画布(可能需要 1.2x 等比例放大使内容充满可见区)
# 上部内容贴顶 y=0,下部内容贴底 y=TH-h
canvas = Image.new("RGBA", (TW, TH), (0, 0, 0, 0))
canvas.paste(top_scaled, (x_center, 0), top_scaled)
canvas.paste(bottom_scaled, (x_center, TH - bottom_h), bottom_scaled)
# 不可编辑区透明化
canvas_arr = np.array(canvas)
canvas_arr[115:1650, 46:1007, 3] = 0 # 不可编辑区
# 左右边距透明化
canvas_arr[:, :46, 3] = 0 # 左侧
canvas_arr[:, 1007:, 3] = 0 # 右侧
result = Image.fromarray(canvas_arr)
result.save("cover.png")
TW, TH = 480, 384
canvas = Image.new("RGBA", (TW, TH), (0, 0, 0, 0))
# 同理缩放、贴顶、贴底
canvas.paste(top_scaled, (x_center, 0), top_scaled)
canvas.paste(bottom_scaled, (x_center, TH - bottom_h), bottom_scaled)
# 不可编辑区透明化
canvas_arr = np.array(canvas)
canvas_arr[61:312, 10:470, 3] = 0 # 不可编辑区
# 左右边距透明化
canvas_arr[:, :10, 3] = 0
canvas_arr[:, 470:, 3] = 0
result = Image.fromarray(canvas_arr)
result.save("banner.png")
所有 PNG 使用 pngquant 压缩到 300KB 以内:
pngquant --quality=45-85 --force --output OUTPUT.png INPUT.png
| 类型 | 命名格式 | 示例 |
|---|---|---|
| 处理后视频 | {name}-processed.mp4 | star-dream-processed.mp4 |
| 封面图 | {name}-cover.png | star-dream-cover.png |
| 横幅图 | {name}-banner.png | star-dream-banner.png |
用户可指定其他命名,以用户要求为准。
| 交付物 | 格式 | 规格 |
|---|---|---|
| 处理后视频 | .mp4 | 958×1278, 3000kbit/s, H.264, 模糊扩边+60px羽化 |
音频保留/去除、智能变速均按用户要求执行。
| 交付物 | 格式 | 规格 |
|---|---|---|
| 封面蒙版图 | .png | 1053×1746, 不可编辑区透明, 左右透明, <300KB |
| 横幅蒙版图 | .png | 480×384, 不可编辑区透明, 左右透明, <300KB |
以上全部交付。
处理过程中如用户要求微调,支持以下操作:
-b:v 值-anpipx install auto-editor,不要用 pip(系统环境限制)-y 避免交互式确认阻塞-anfps=30;≤30 时可省略