#!/bin/bash # should be run through output pipe, exit otherwise [ -t 1 ] && echo "ERROR: should declare output as a pipe, ie > output.mp4" && exit -1 # detect current dir DIR=$(pwd) # build temporary file which contains all the files to append tempfile=$(mktemp) for i in $@; do echo file $DIR/$i >> $tempfile done # output as matroska file ffmpeg -safe 0 -f concat -i $tempfile -c copy -f matroska -