Skip to content

Instantly share code, notes, and snippets.

@yairsz
Created March 13, 2014 02:11
Show Gist options
  • Save yairsz/9520741 to your computer and use it in GitHub Desktop.
Save yairsz/9520741 to your computer and use it in GitHub Desktop.
Bash Script to Cut up pieces of video files in a directory using FFMPEG
#!/bin/bash
FILES="/Users/yair/Movies/SoundsOfThePlanets/*.mp4"
#this script creates small pieces of videos out of a directory of .mp4
i=0
for f in $FILES
do
echo "Processing $f file..."
i=`expr $i + 1`
# take action on each file. $f store current file name
for num in {1..13}
do
echo "Number: $num"
#set the start time of each piece and run ffmpeg
START=`expr $num \* 22`
ffmpeg -i "$f" -vcodec copy -acodec copy -ss $START -t 0.865 grains/$i-$num.mp4
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment