20 lines
408 B
Bash
Executable file
20 lines
408 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
tmpext="_mp4-concat.tmp.ts"
|
|
TMP_FILES=()
|
|
|
|
for f in "$@"; do
|
|
TMP_FILES+=("$f$tmpext")
|
|
ffmpeg -i "$f" -c copy -bsf:v h264_mp4toannexb -f mpegts "$f$tmpext"
|
|
done
|
|
|
|
concat_files=$(printf "|%s" "${TMP_FILES[@]}")
|
|
concat_files=${concat_files:1}
|
|
|
|
ffmpeg -i "concat:$concat_files" -c copy -bsf:a aac_adtstoasc "mp4concat_${RANDOM}.mp4"
|
|
|
|
for f in "${TMP_FILES[@]}"; do
|
|
rm "$f"
|
|
done
|