FFMPEG An Intermediate Guide/Concatenation

With this script, multiple videos can be put together into one file. The process uses the  parameter, meaning the video file is built from the existing video streams, and no processor-intensive re-encoding is necessary.

ffmpeg_concat {

timestamp=$(date "+%Y%m%d%H%M%S") # Unlike in JavaScript, no spaces may surround the "=" equals sign to set a variable.

for path in $@; do echo "file '$path' " >>ffmpeg_concat.$timestamp.txt # ffmpeg only supports apostrophes, no quotation marks. done
 * 1) generate file list

printf "Output file extension: " read output_extension
 * 1) ask user for output file extension to specify which container format should be used by FFmpeg

ffmpeg -f concat -safe 0 -i ffmpeg_concat.$timestamp.txt -c copy ffmpeg_concat.$timestamp.$output_extension
 * 1) put it together
 * 1) -safe 0  allows concatinating files outside the current working directory
 * 2) -c copy  passes through the existing video and audio streams without re-encoding it and only multiplexes it, making the process take only a fraction of the time since disk reading/writing speeds are the only limitation.

}