将单个视频输入文件分割为30秒的块 [英] Split single video input files into 30 second blocks
问题描述
我正在尝试将几个视频文件(.mov)分成30秒的块.
I am trying to split several video files (.mov) into 30 second blocks.
我不需要指定30秒的开始或结束时间.
I do not need to specify where the 30 seconds start or finish.
示例-单个45秒的视频(VID1.mov)将被分为VID1_part1.mov(30秒),VID1_part2.mov(15秒).理想情况下,我也可以删除音频.
EXAMPLE- A single 45 second video (VID1.mov) will be split into VID1_part1.mov (30 seconds), VID1_part2.mov (15 seconds). Ideally, I can remove audio too.
我尝试使用bash(osx),但未成功.它没有将视频分成多个部分-而是似乎只是在修改原始文件(并将其长度缩短为1-2秒):
I made an attempt, using bash (osx), but was unsuccessful. It did not split the video into multiple parts- instead it just seemed to modify the original file (and made it into a length of 1-2 seconds):
find . -name '*.mov' -exec ffmpeg -t 30 -i \{\} -c copy \{\} \;
推荐答案
您可以为此使用FFmpeg的分段混合器.
You can use FFmpeg's segment muxer for this.
ffmpeg -i input -c copy -segment_time 30 -f segment input%d.mov
取决于视频关键帧的位置,每个片段都不会以mod 30秒开始.您必须为此省略-c copy
.
Depending on where the video keyframes are, each segment won't start at mod 30 secs. You'll have to omit -c copy
for that.
此外,FFmpeg不执行就地编辑.您的bash脚本似乎也显示输出的输入名称.那行不通.
Also, FFmpeg does not do in-place editing. Your bash script seems to present the input name for output as well. That won't work.
这篇关于将单个视频输入文件分割为30秒的块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!