Created
April 23, 2021 22:03
-
-
Save rougeth/8a9ad370fecd0e6ba03e75f6132bb81d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cut_and_concat () | |
{ | |
SOURCE=$PWD/$1 | |
OUTPUT=$PWD/$2 | |
OPENING=$PWD/$3 | |
START_AT=$4 | |
END_AT=$5 | |
TIMESTAMP=$(date +"%Y%m%d%H%M%S") | |
DIR="$PWD/output_${TIMESTAMP}" | |
mkdir -p $DIR | |
TMP_OUTPUT="$DIR/tmp.mp4" | |
TMP_LIST="$DIR/list.txt" | |
echo -e "file '${OPENING}'\nfile '${TMP_OUTPUT}'\n" > $TMP_LIST | |
ffmpeg -y -i ${SOURCE} -ss ${START_AT} -t ${END_AT} "${TMP_OUTPUT}" | |
ffmpeg -y -f concat -safe 0 -i $TMP_LIST "${OUTPUT}" | |
rm -rf $DIR | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment