Skip to content

Instantly share code, notes, and snippets.

@morgner
Last active December 30, 2017 13:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morgner/d2a4f48acd14462e5c8b5325f137016d to your computer and use it in GitHub Desktop.
Save morgner/d2a4f48acd14462e5c8b5325f137016d to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
# all files "*[0-9].mp4" to menu e.g:
# good : gear-v1.mp4
# bad : gear-v1m.mp4
# menuentries: "${FN} +"
MENU="`ls -Rt1 *[0-9].mp4 | sed '-e s/^\(.*\)$/\1 +/'`"
FN=`dialog --menu "Multiply video" 0 0 13 ${MENU} 3>&1 1>&2 2>&3 3>&-`
if [ $? -eq 0 ]
then
# $RC times (repeat count)
RC=6
# concat concatinate
# safe 0 the file name safety is not to be discussed
# filesecriptor contains a 'flying file' with $RC times "file ${PWD}/${FN}"
# copy the output filename (*.mp4 => *m.mp4)
ffmpeg -f concat \
-safe 0 \
-i <(for N in $(seq 1 ${RC}); do echo "file ${PWD}/${FN}"; done) \
-c copy "${PWD}/`echo ${FN} | sed -e 's/\(\.mp4\)$/m\1/'`"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment