From 351565bf02f45a5c81c60a2cfa00154b3fdeed3f Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Fri, 2 Dec 2016 12:52:56 +0100 Subject: [PATCH] Add a script to create test files --- shell/create_test_files.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 shell/create_test_files.sh diff --git a/shell/create_test_files.sh b/shell/create_test_files.sh new file mode 100755 index 0000000..707172a --- /dev/null +++ b/shell/create_test_files.sh @@ -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 -- 2.1.4