#!/bin/sh
# ffmpeg_concat.sh
# 2023-01-02
# by Gernot Walzl
# This script uses ffmpeg to concatenate video files.
# Usage: ./ffmpeg_concat.sh input1.mp4 input2.mp4 input3.mp4 ...
# https://ffmpeg.org/ffmpeg-filters.html
# VIDEOFILTER=${VIDEOFILTER:-'framestep=2,scale=1920:1080'}
VIDEOFILTER=${VIDEOFILTER:-'scale=1920:1080'}
OUTPUT=${OUTPUT:-'output.mp4'}
echo -n > filelist.txt
for FILE in "$@"; do
echo "file '$FILE'" >> filelist.txt
done
ffmpeg -f concat -i filelist.txt \
-vf "$VIDEOFILTER" \
-preset veryslow \
-movflags faststart "$OUTPUT"