Add ges-videocrop-effect.sh
[experiments/gstreamer.git] / shell / ges-videocrop-effect.sh
1 #!/bin/sh
2 #
3 # Example of how to apply a videocrop effect in a GES pipeline.
4 #
5 # Crop and Scale the circular pattern, and put into the white rectangle of the
6 # smtpe pattern.
7
8 set -e
9
10 CROP_TOP=40
11 CROP_BOTTOM=80
12 CROP_LEFT=100
13 CROP_RIGHT=110
14
15 POSX=52
16 POSY=180
17
18 WIDTH=320
19 HEIGHT=240
20
21 SCALED_WIDTH=160
22 SCALED_HEIGHT=120
23
24 H_RATIO=$((WIDTH / SCALED_WIDTH))
25 V_RATIO=$((HEIGHT / SCALED_HEIGHT))
26
27 ges-launch-1.0 \
28   +test-clip smpte s=0 d=2 \
29   +test-clip circular s=0 d=2 set-alpha 0.9 \
30     set-posx $POSX \
31     set-posy $POSY \
32   +effect videocrop set-top $CROP_TOP set-bottom $CROP_BOTTOM set-left $CROP_LEFT set-right $CROP_RIGHT \
33     set-width $((SCALED_WIDTH - CROP_LEFT / H_RATIO - CROP_RIGHT / H_RATIO)) \
34     set-height $((SCALED_HEIGHT - CROP_TOP / V_RATIO - CROP_BOTTOM / V_RATIO))