Add a script to create test files
authorAntonio Ospite <ao2@ao2.it>
Fri, 2 Dec 2016 11:52:56 +0000 (12:52 +0100)
committerAntonio Ospite <ao2@ao2.it>
Fri, 2 Dec 2016 11:52:56 +0000 (12:52 +0100)
shell/create_test_files.sh [new file with mode: 0755]

diff --git a/shell/create_test_files.sh b/shell/create_test_files.sh
new file mode 100755 (executable)
index 0000000..707172a
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+set -x
+
+SECONDS=4
+
+VIDEO_FRAMERATE=25
+VIDEO_BUFFERS=$(($VIDEO_FRAMERATE * $SECONDS))
+
+AUDIO_SAMPLERATE=48000
+AUDIO_SAMPLESPERBUFFER=1024
+AUDIO_BUFFERS=$(($AUDIO_SAMPLERATE * $SECONDS / $AUDIO_SAMPLESPERBUFFER))
+
+create_sample() {
+  FREQ="$1"
+  rm -f "sample_${FREQ}hz.webm"
+  gst-launch-1.0 -e \
+    webmmux name=mux ! filesink location="sample_${FREQ}hz.webm" \
+    videotestsrc pattern=black num-buffers="$VIDEO_BUFFERS" ! video/x-raw,framerate="$VIDEO_FRAMERATE/1" ! \
+        textoverlay valignment=center halignment=center font-desc="Mono, 72" text="${FREQ}Hz" ! \
+        queue ! vp9enc ! mux. \
+    audiotestsrc samplesperbuffer="$AUDIO_SAMPLESPERBUFFER" num-buffers="$AUDIO_BUFFERS" freq="$FREQ" ! audio/x-raw,rate="$AUDIO_SAMPLERATE" ! \
+        queue ! audioconvert ! vorbisenc quality=0.5 ! queue ! mux.
+}
+
+create_sample 440
+create_sample 880