From: Antonio Ospite Date: Fri, 2 Dec 2016 11:52:56 +0000 (+0100) Subject: Add a script to create test files X-Git-Url: https://git.ao2.it/experiments/gstreamer.git/commitdiff_plain/351565bf02f45a5c81c60a2cfa00154b3fdeed3f Add a script to create test files --- 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