#!/bin/bash #B. Vandeportaele #script to concatenate video files from the GOPRO using ffmpeg #if the filenames are not in sequence as generated by the script, a list of file can be used. The file containing the list should be #made of lines such as: file 'GOPR0650.MP4' #ffmpeg -f concat -safe 0 -i file-list_to_concatenate.txt -ss 1:16 -t 30:00 -c copy GOPR0650_complete_cut.MP4 NUMBER=0711 START_TIME="0:19" DURATION="10:00:00" rm ./filelisttoconcatenate.txt #begin with a list of 1 file echo "file './GOPR$NUMBER.MP4'" >> filelisttoconcatenate.txt #loop for 10 next files and try to detect if the file exists then add it to the list for I in `seq -w 1 10`; do file="GP$I$NUMBER.MP4" if [ -f "$file" ] then echo "$file found." # LIST="$LIST|$file" echo "file ./'$file'" >> filelisttoconcatenate.txt else echo "$file not found." fi done echo " " >> filelisttoconcatenate.txt #generate an output file name OUTFILE="GOPR${NUMBER}_completecut.MP4" #generate the command COMMAND="ffmpeg -f concat -safe 0 -i filelisttoconcatenate.txt -ss $START_TIME -t $DURATION -c copy $OUTFILE" echo "Do you want to execute the following command (y/n):" echo $COMMAND read line if [ "$line" == "y" ]; then #execute the command in the variable eval "$COMMAND" fi