[NetBehaviour] action replay quick script ffmpeg

James Morris james at jwm-art.net
Mon Nov 16 00:41:11 CET 2015


# quick script to make action replays using ffmpeg
#
#!/bin/bash
#

declare -a STARTS
declare -a LENGTH

OUTN="drop"
OUTE="mov"

FILE+=("FILE0025.MOV");	START+=("00:00:00");	LENGTH+=("00:00:05");

FILE+=("FILE0023.MOV");	START+=("00:00:25");	LENGTH+=("00:00:04");
FILE+=("FILE0023.MOV");	START+=("00:00:26.5"); 	LENGTH+=("00:00:01.5");
FILE+=("FILE0023.MOV");	START+=("00:00:26.95"); LENGTH+=("00:00:00.9");
FILE+=("FILE0023.MOV");	START+=("00:00:26.95"); LENGTH+=("00:00:00.9");

FILE+=("FILE0024.MOV");	START+=("00:00:06");	LENGTH+=("00:00:04");
FILE+=("FILE0024.MOV");	START+=("00:00:08");	LENGTH+=("00:00:01.5");
FILE+=("FILE0024.MOV");	START+=("00:00:08.5");	LENGTH+=("00:00:00.8");
FILE+=("FILE0024.MOV");	START+=("00:00:08.5");	LENGTH+=("00:00:00.8");

FILE+=("FILE0026.MOV");	START+=("00:00:07");	LENGTH+=("00:00:02");
FILE+=("FILE0026.MOV");	START+=("00:00:08");	LENGTH+=("00:00:00.85");
FILE+=("FILE0026.MOV");	START+=("00:00:08");	LENGTH+=("00:00:00.85");
FILE+=("FILE0026.MOV");	START+=("00:00:08");	LENGTH+=("00:00:05");

N=0

for F in "${FILE[@]}"
do
   OUT=$(printf "${OUTN}%02d.${OUTE}" $N)
   if [[ ${START[$N]} ]]
   then
     echo  "Clip $N: start ${START[$N]}  length ${LENGTH[$N]}... "
     ffmpeg -y -ss "${START[$N]}" -i ${FILE[$N]} -t "${LENGTH[$N]}" \
     -vcodec copy -acodec copy $OUT
     FILES+=("$OUT")
   fi
   N=$((N+1))
done

ffmpeg -y -f concat -i <(printf "file '$PWD/%s'\n" "${FILES[@]}") \
-c copy drop.mov



More information about the NetBehaviour mailing list