Ycon
Ycon

Reputation: 1950

Split single video input files into 30 second blocks

I am trying to split several video files (.mov) into 30 second blocks.

I do not need to specify where the 30 seconds start or finish.

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.

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 \{\} \;

Upvotes: 1

Views: 2482

Answers (1)

Gyan
Gyan

Reputation: 92938

You can use FFmpeg's segment muxer for this.

ffmpeg -i input -c copy -segment_time 30 -f segment input%d.mov

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.

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.

Upvotes: 2

Related Questions