Add ges-videocrop-effect.sh
authorAntonio Ospite <ao2@ao2.it>
Fri, 30 Mar 2018 16:12:42 +0000 (18:12 +0200)
committerAntonio Ospite <ao2@ao2.it>
Fri, 30 Mar 2018 16:12:42 +0000 (18:12 +0200)
Add an example of how to apply a videocrop effect in a GES pipeline.

shell/ges-videocrop-effect.sh [new file with mode: 0755]

diff --git a/shell/ges-videocrop-effect.sh b/shell/ges-videocrop-effect.sh
new file mode 100755 (executable)
index 0000000..177af86
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Example of how to apply a videocrop effect in a GES pipeline.
+#
+# Crop and Scale the circular pattern, and put into the white rectangle of the
+# smtpe pattern.
+
+set -e
+
+CROP_TOP=40
+CROP_BOTTOM=80
+CROP_LEFT=100
+CROP_RIGHT=110
+
+POSX=52
+POSY=180
+
+WIDTH=320
+HEIGHT=240
+
+SCALED_WIDTH=160
+SCALED_HEIGHT=120
+
+H_RATIO=$((WIDTH / SCALED_WIDTH))
+V_RATIO=$((HEIGHT / SCALED_HEIGHT))
+
+ges-launch-1.0 \
+  +test-clip smpte s=0 d=2 \
+  +test-clip circular s=0 d=2 set-alpha 0.9 \
+    set-posx $POSX \
+    set-posy $POSY \
+  +effect videocrop set-top $CROP_TOP set-bottom $CROP_BOTTOM set-left $CROP_LEFT set-right $CROP_RIGHT \
+    set-width $((SCALED_WIDTH - CROP_LEFT / H_RATIO - CROP_RIGHT / H_RATIO)) \
+    set-height $((SCALED_HEIGHT - CROP_TOP / V_RATIO - CROP_BOTTOM / V_RATIO))