-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.sh
executable file
·102 lines (88 loc) · 3.21 KB
/
test.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
set -e
# Set variables based on OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
LIB_EXT="so"
VIDEO_SINK="xvimagesink"
elif [[ "$OSTYPE" == "darwin"* ]]; then
LIB_EXT="dylib"
VIDEO_SINK="osxvideosink"
else
echo "Unsupported OS!"
exit 1
fi
# Check if gst-inspect-1.0 is installed
if ! command -v gst-inspect-1.0 > /dev/null 2>&1; then
echo "gst-inspect-1.0 is not installed. Please install it and try again."
exit 1
fi
# Check if gst-launch-1.0 is installed
if ! command -v gst-launch-1.0 > /dev/null 2>&1; then
echo "gst-launch-1.0 is not installed. Please install it and try again."
exit 1
fi
# Check if plugin is installed
if [ ! -f "$HOME/.local/share/gstreamer-1.0/plugins/libgstprojectm.$LIB_EXT" ]; then
echo "libgstprojectm.$LIB_EXT is missing. Please install it and try again."
exit 1
fi
# Check if output directory exists, if not create it
if [ ! -d "test/output" ]; then
mkdir -p test/output
fi
echo
echo
case "$1" in
"--details")
gst-inspect-1.0 --plugin projectm
;;
"--inspect")
gst-inspect-1.0 projectm
;;
"--audio")
GST_DEBUG=projectm:5 gst-launch-1.0 -v \
audiotestsrc ! queue ! audioconvert ! \
projectm \
! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! $VIDEO_SINK sync=false
;;
"--preset")
GST_DEBUG=4 gst-launch-1.0 -v \
audiotestsrc ! queue ! audioconvert ! \
projectm preset="test/presets/250-wavecode.milk.milk" \
! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! $VIDEO_SINK sync=false
;;
"--properties")
GST_DEBUG=3 gst-launch-1.0 -v \
audiotestsrc ! queue ! audioconvert ! \
projectm \
preset="test/presets/250-wavecode.milk.milk" \
texture-dir="test/textures" \
beat-sensitivity=0.5 \
hard-cut-duration=1 \
hard-cut-enabled=true \
hard-cut-sensitivity=0.5 \
soft-cut-duration=1 \
preset-duration=30 \
mesh-size="512,512" \
easter-egg=0.75 \
preset-locked=false \
! "video/x-raw,width=512,height=512,framerate=30/1" ! videoconvert ! $VIDEO_SINK sync=false
;;
"--output-video")
GST_DEBUG=3 gst-launch-1.0 -v \
filesrc location="test/audio/upbeat-future-bass.mp3" ! decodebin ! audioconvert ! \
projectm preset="test/presets/250-wavecode.milk.milk" ! videoscale ! videoconvert ! video/x-raw,width=1280,height=720 ! \
x264enc ! mp4mux ! filesink location="test/output/test_video.mp4"
;;
"--encode-output-video")
GST_DEBUG=3 gst-launch-1.0 -v \
filesrc location="test/audio/upbeat-future-bass.mp3" ! decodebin name=dec ! \
audioconvert ! avenc_aac ! avmux_mp4 ! filesink location="test/output/video2.mp4" \
dec. ! \
projectm preset="test/presets/250-wavecode.milk.milk" ! videoconvert ! x264enc ! avenc_mp4 ! avmux_mp4.video_0
;;
*)
echo "Usage: $0 [--details|--inspect|--audio|--preset|--properties|--output-video|--encode-output-video]"
exit 1
;;
esac