-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAudioJumpcut.sh
executable file
·79 lines (69 loc) · 3.29 KB
/
AudioJumpcut.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
#================================================================================
# AUTHOR
# Clint Box
# https://www.youtube.com/bearcatjamboree
#
# FUNCTION
# Jump cut video using audio level
#
# DETAILS
# This script will invoke VideoJumpcutter using a specific file and will
# perform audio jump cut
#
# USAGE
# ${SCRIPT_NAME} "video_path"
#================================================================================
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
echo "${machine}"
input_file="$1"
##############################################################################
# Check for file was passed. Show open file dialog if no argument and on Mac
###############################################################################
if ! [ -f "$input_file" ]; then
if [[ "$machine" == "Mac" ]]; then
input_file=$(osascript -e 'tell application (path to frontmost application as text)
set input_file to choose file with prompt "Please choose a file to process"
POSIX path of input_file
end')
elif [[ "$machine" == "Linux" ]]; then
input_file=$(dialog --title "Choose a file" --stdout --title "Please choose a file to process" --fselect ~/ 14 48)
elif [[ "$machine" == "Cygwin" ]]; then
input_file=$(dialog --title "Choose a file" --stdout --title "Please choose a file to process" --fselect ~/ 14 48)
elif [ "$#" -ne 1 ] || ! [ -f "$input_file" ]; then
echo "Usage: $0 input_file"
exit 1
fi
fi
if ! [ -f "$input_file" ]; then
echo "Usage: $0 input_file"
exit 1
fi
####################################
# Remove backlashes from filepaths
####################################
file=$(echo "$input_file"|tr -d '\\')
####################################
# Separate file name from extension
####################################
ext="${file##*.}"
name="${file%.*}"
############################
# Get file path information
############################
outfile="$name"_highlights
newoutfile=$outfile.$ext
python VideoJumpcutter.py --input_file "$input_file" --output_file "$newoutfile" --audio_method 1 --volume_selection "rms" --audio_threshold 0.1 --frame_margin 120
#python VideoJumpcutter.py --input_file "$input_file" --output_file "$newoutfile" --audio_method 1 --volume_selection "rms" --audio_threshold 0.2 --frame_margin 60
#python VideoJumpcutter.py --input_file "$input_file" --output_file "$newoutfile" --audio_method 1 --volume_selection "max" --audio_threshold 0.01 --frame_margin 60
#python VideoJumpcutter.py --input_file "$input_file" --output_file "$newoutfile" --audio_method 1 --volume_selection "max" --audio_threshold 0.75 --frame_margin 600
#python VideoJumpcutter.py --input_file "$input_file" --output_file "$newoutfile" --audio_method 1 --volume_selection "rms" --audio_threshold 0.2 --frame_margin 600
#python VideoJumpcutter.py --input_file "$input_file" --output_file "$newoutfile" --audio_method 1 --volume_selection "rms" --audio_threshold 0.40 --frame_margin 150
#python VideoJumpcutter.py --input_file "$input_file" --output_file "$newoutfile" --audio_method 1 --volume_selection "rms" --audio_threshold 0.7 --frame_margin 60