-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvid-deshake.sh
executable file
·68 lines (44 loc) · 1.56 KB
/
vid-deshake.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# Bash Script for deshaking a videofile
#
# Requires: ffmpeg
#
# 20171207 - jEsuSdA
# Function to obtain the filename without extension
# e.g:
# cambiaext pepito.grillo.avi
# namefich=pepito.grillo.
function cambiaext {
str=$1
ext=`echo ${str:(-5)} | cut -d . -f 2`
len_ext=${#ext}
len_cad=${#str}
titulo=$[len_cad-len_ext]
namefich=${str:0:($titulo)}
}
# ----------------------------------------------------------
# The FFMPEG VIDSATAB way
#
# More info at: https://github.com/georgmartius/vid.stab
if [ $# -eq 0 ]
then
echo "Usage: vid-deshake.sh <video to stabilize>"
else
origen="$1"
cambiaext "$1"
vidout=$namefich"avi"
ffmpeg -i "$1" -vf vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf" -f null -
ffmpeg -i "$1" -vf unsharp=5:5:0.8:3:3:0.4,vidstabtransform=zoom=5:smoothing=30:input="mytransforms.trf" "$namefich"stabilized.mkv
rm -rf "mytransforms.trf"
fi
# ----------------------------------------------------------
# Old way with transcode (does not work at all now)
#transcode -J stabilize=shakiness=8=mincontrast=0.04=fieldsize=60 -i "$1"
#transcode -J transform=crop=1=optzoom=4 --mplayer_probe -i "$1" -y raw -o "$1""-stabilized.avi"
# info:
# http://www.transcoding.org/transcode?Filter_Plugins/Filter_Stabilize
# http://www.transcoding.org/transcode?Filter_Plugins
# http://isenmann.wordpress.com/2011/03/22/deshaking-videos-with-linux/
# http://public.hronopik.de/vid.stab/features.php?lang=en
# http://blog.hamoid.com/stabilize-video-in-ubuntu-linux
# http://mcfrisk.kapsi.fi/linux/video/#index2h2