ffmpeg-video-editing

支持视频切割、拼接、分段等基础编辑操作,基于 FFmpeg 实现。

已扫描
适合谁
视频内容创作者、自媒体运营人员
不适合谁
无 FFmpeg 使用经验的初学者、需要复杂特效或图形编辑的用户
国内可用性
需网络配置。可能需要网络配置或第三方服务可访问。
安装难度
新手友好(★☆☆)。基于终端操作、依赖、API Key 和本地环境要求的初步判断。

安装与下载

openclaw skills install @lnj22/multilingual-video-dubbing-ffmpeg-video-editing

Skill 说明

命令、参数、文件名以原文为准

FFmpeg 视频编辑技能

基础视频编辑操作:剪切、裁剪、拼接和分割视频。

何时使用

  • 从视频中剪切片段
  • 裁剪视频长度
  • 拼接多个视频
  • 将视频拆分为多个部分
  • 提取特定时间段的内容

剪切与裁剪

# 从第10秒到第30秒剪切(使用 -ss 和 -to)
ffmpeg -ss 00:00:10 -to 00:00:30 -i input.mp4 -c copy output.mp4

# 从第10秒开始,持续20秒
ffmpeg -ss 00:00:10 -t 20 -i input.mp4 -c copy output.mp4

# 前60秒
ffmpeg -t 60 -i input.mp4 -c copy output.mp4

# 最后30秒(需先获取视频总时长)
ffmpeg -sseof -30 -i input.mp4 -c copy output.mp4

精确剪切

# 重新编码(更精确)
ffmpeg -ss 00:00:10 -i input.mp4 -t 20 -c:v libx264 -c:a aac output.mp4

# 关键帧级精确(更快,但可能略不精确)
ffmpeg -ss 00:00:10 -i input.mp4 -t 20 -c copy output.mp4

视频拼接

方法一:文件列表(推荐)

# 创建 list.txt 文件:
# file 'video1.mp4'
# file 'video2.mp4'
# file 'video3.mp4'

ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4

方法二:相同编码格式的文件

# 若所有视频具有相同的编码/格式
ffmpeg -i "concat:video1.mp4|video2.mp4|video3.mp4" -c copy output.mp4

方法三:重新编码(不同编码格式)

# 重新编码以确保兼容性
ffmpeg -f concat -safe 0 -i list.txt -c:v libx264 -c:a aac output.mp4

视频分割

# 按60秒分段
ffmpeg -i input.mp4 -c copy -f segment -segment_time 60 \
  -reset_timestamps 1 output_%03d.mp4

# 在指定时间点分割
ffmpeg -i input.mp4 -ss 00:00:00 -t 00:01:00 -c copy part1.mp4
ffmpeg -i input.mp4 -ss 00:01:00 -t 00:01:00 -c copy part2.mp4

重新编码提取片段

# 当需要更改质量或编码格式时
ffmpeg -ss 00:00:10 -i input.mp4 -t 20 \
  -c:v libx264 -crf 23 -c:a aac -b:a 192k output.mp4

多个片段提取

# 提取多个片段
ffmpeg -i input.mp4 \
  -ss 00:00:10 -t 00:00:05 -c copy segment1.mp4 \
  -ss 00:01:00 -t 00:00:10 -c copy segment2.mp4

注意事项

  • 使用 -c copy 可提升速度(无需重新编码)
  • -ss 放在 -i 之前更快但精度较低
  • -ss 放在 -i 之后更精确但较慢
  • 拼接时若使用 -c copy,要求所有视频编码格式一致
  • 推荐使用文件列表方法以获得最佳拼接效果
L
@lnj22

已收录 6 个 Skill

相关推荐