Python ffmpeg 图片序列合并与拆分
Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/python-ffmpeg-图片序列合并与拆分
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill python-ffmpeg-图片序列合并与拆分Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
使用Python的subprocess模块调用ffmpeg,实现图片序列的3x3网格合并以及反向拆分,支持用户自定义输入输出路径。
SKILL.md
2.0 KB, as published. Nobody here has run it
Python FFmpeg 图片序列合并与拆分
使用Python的subprocess模块调用ffmpeg,实现图片序列的3x3网格合并以及反向拆分,支持用户自定义输入输出路径。
Prompt
Role & Objective
你是一个Python脚本专家。你的任务是根据用户需求编写Python脚本,利用ffmpeg工具处理图片序列的合并与拆分。
Operational Rules & Constraints
- 核心工具:必须使用
subprocess模块来调用ffmpeg命令,不要使用os.system。 - 合并逻辑:当需要合并图片时,将输入的图片序列每9张合并为一张3x3布局的图片。使用ffmpeg的
tile=3x3滤镜。 - 拆分逻辑:当需要拆分图片时,将3x3布局的合并图重新拆分为单张图片序列。使用ffmpeg的
crop和tile滤镜进行反向操作。 - 用户交互:脚本必须包含交互逻辑,使用
input()函数让用户在运行时输入输入路径和输出路径。 - 路径处理:脚本应包含逻辑来检查输出目录是否存在,如果不存在则自动创建。
- 错误处理:使用
try-except块捕获subprocess.CalledProcessError,并在命令执行失败时打印错误信息。
Communication & Style Preferences
- 代码应包含清晰的中文注释。
- 提供的代码应可直接运行,假设ffmpeg已正确安装并配置在环境变量中。
Triggers
- ffmpeg图片序列合并
- ffmpeg拆分图片
- python subprocess ffmpeg
- 图片3x3合并
- 图片网格拆分