forked from KonradIT/gopro-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gopro
executable file
·72 lines (65 loc) · 2.75 KB
/
gopro
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
67
68
69
70
71
72
#!/bin/bash
function timelapse() {
framerate="$1"
filename="$2"
resolution_width="$3"
resolution_height="$4"
ls -1tr > gopro_timelapse_list.txt
mencoder -nosound -ovc lavc -lavcopts \
vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 \
-vf scale=$resolution_width:$resolution_height -mf type=jpeg:fps=$framerate \
mf://@gopro_timelapse_list.txt -o $filename
}
function superview() {
for i in *.MP4;
do name=`echo $i | cut -d'.' -f1`+S;
echo $name;
ffmpeg -i $i -sameq -vcodec mpeg4 -acodec ac3 -aspect 16:9 -strict experimental $name.MP4
done
}
function fisheye(){
mogrify -distort barrel "0 0 -0.3" *.JPG
}
function convert(){
for i in *.MP4;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i $i -sameq -vcodec mpeg4 $name.mov;
done
}
function slowmo(){
ffmpeg -i $1 -r 25 -vf "setpts=(9.6/1)*PTS" -sameq -vcodec libx264 $2
echo "Video slowed down, use trim to trim the video"
}
function trim(){
ffmpeg -i $1 -ss $3 -t $4 -sameq -vcodec libx264 $2
}
function sort(){
mkdir $1
cd $1
mkdir videos
mkdir photos
mkdir photos/single
mkdir photos/timelapse-burst-continuous
mkdir videos/single
mkdir videos/chaptered
mkdir videos/thumbnails
mkdir videos/lowresvideos
cp GOPR*.MP4 videos/single
cp GP*.MP4 videos/chaptered
cp GOPR*.JPG photos/single
cp G*.JPG timelapse-burst-continuous
cp *.LRV videos/lowresvideos
cp *.THM videos/thumbnails
echo "Finished!"
}
function help() {
printf 'GoPro Tool for Linux OS\nAvailable commands:\n\n- gopro timelapse [fps] [outfilename] [res width] [res height]\nMakes a timelapse with pictures in the current folder, make sure to cd to a DCIM/XXXGOPRO folder!\nExample: gopro timelapse 30 goproTL.mp4 1920 1080\n\n- gopro superview\nApplies SuperView to all GoPro videos in the current dir\n\n- gopro fisheye\nFixes barrel distorsion to all GoPro pictures in the current folder\n\n- gopro convert\nConverts all GoPro MP4 videos to MPEG4 MOV videos for easy editing\n\n- gopro slowmo [video]\nReduces the speed in a High FPS GoPro Video\nExample: gopro slowmo GOPRO0553.MP4\n\n- gopro trim [input video] [output video] [HH:MM:SS start] [HH:MM:SS stop]\nTrims a video, use this to trim a slow motion video!\nExample: gopro trim GOPR0553.MP4 Trimmed.mp4 00:05:04 00:07:43\n\n- gopro sort\nSorts media, please execute in DCIM/XXXGOPRO!\n\nScript by Konrad Iturbe (@KonradIT on GitHub | @konrad_it on Twitter)\n'
}
echo "GoPro Tool for Linux"
echo "To see a list of commands and syntax available run: gopro help"
echo "Checking dependencies..."
hash ffmpeg 2> /dev/null || { echo >&2 "ffmpeg ..... Not installed!";}
hash mogrify 2> /dev/null || { echo >&2 "mogrify ..... Not installed!";}
hash mencoder 2> /dev/null || { echo >&2 "mencoder ..... Not installed!";}
$@