-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdelay_video.sh
executable file
·48 lines (37 loc) · 1.11 KB
/
delay_video.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# delays the video in a file without transcoding
# Arguments:
# $1: Input File 1
# $2: Delay time in seconds
_usage(){
cat <<EOF
$(basename "${0}")
Usage
$(basename "${0}") MOVIE_FILE.mov
Explanation:
This script will delay the video of a file without retranscoding either the audio of video streams
Options
-h display this help
Input Arguments
MOVIE_FILE.mov: Input file
Delay time in seconds
Dependencies: FFmpeg
EOF
}
if [[ ${1} == "-h" ]]; then
_usage ; exit 0
fi
if [[ -f ${1} ]]; then
printf "Input File: ${1} \n" >&2
else
printf "ERROR: Input argument must be a valid file \n" >&2
exit
fi
if [ "$#" -ne 2 ]; then
printf "ERROR: This script requires two arguments to run, the input file path and the delay time in seconds \n" >&2
exit
fi
ffmpeg -i "${1}" -itsoffset ${2} -i "${1}" -map 1:v -map 0:a -c copy "${1%.*}_delayedVideo.mov"
printf "\n\n*******START FFMPEG COMMANDS*******\n" >&2
printf "ffmpeg -i '$1' -itsoffset $2 -i '$1' -map 1:v -map 0:a -c copy '${1%.*}_delayedVideo.mov' \n" >&2
printf "********END FFMPEG COMMANDS********\n\n " >&2