`ffmpeg` doesn't recognize input from pipe for merging mp4 via concat demuxer

Solution 1:

According to the bug tracker of ffmpeg, there were changes in the newer versions. Since the release between 4.2.2 and 4.3.2, the handling of relative URLs have been fixed to make it compatible with the official recommendations.

If there are bare file names in the concat script, the files are supposed to reside in the same directory (and of course protocol) as the script. Which, of course, is not possible for pipe:, but still applies. If the script is saved in a temp file, its protocol changes to 'file' and the old way works because of that change.

The piped input needs to specify both the concat file and the protocol file: in the concat code.

Example for now necessary input via pipe protocol: file file:'input_01.mp4' instead of the old file 'input_01.mp4'.

The new version of the script needs to be changed to

#!/usr/bin/env bash

if [ $# -lt 1 ]; then
    echo "Usage: `basename $0` input_1.mp4 input_2.mp4 ... output.mp4"
    exit 0
fi

ARGS=("$@") # determine all arguments
output=${ARGS[${#ARGS[@]}-1]} # get the last argument (output file)
unset ARGS[${#ARGS[@]}-1] # drop it from the array
(for f in "${ARGS[@]}"; do echo "file file:'$f'"; done) | ffmpeg -protocol_whitelist file,pipe -f concat -safe 0 -i pipe: -c:v copy -c:a copy $output

to work.