This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_webm.sh
executable file
·50 lines (43 loc) · 1.63 KB
/
generate_webm.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
#!/bin/bash
# Copyright (C) 2018 Christian Berger
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
FPS=5
for d in $(ls); do
if [ -d $d ]; then
cd $d
CNT=0
FIRST=0
SECOND=0
for i in $(ls *png); do
if [ "$CNT" == "0" ]; then
FIRST=$(echo $i | cut -f1 -d".")
fi
if [ "$CNT" == "1" ]; then
SECOND=$(echo $i | cut -f1 -d".")
FPS=$(echo "1000/(($SECOND-$FIRST)/1000)"|bc)
fi
printf -v j "%09d" $CNT
CNT=$((CNT + 1))
mv $i $j.png
done
if [ "$FPS" == "" ]; then
FPS=10
fi
echo "Using $FPS fps."
png2yuv -I p -f $FPS -j %09d.png -n $(ls -l *png|wc -l) > clip.yuv
vpxenc --good --cpu-used=2 --auto-alt-ref=1 --lag-in-frames=16 --end-usage=vbr --passes=2 --threads=4 --target-bitrate=3000 --minsection-pct=15 --maxsection-pct=400 --kf-min-dist=0 --kf-max-dist=360 --static-thresh=0 --min-q=4 --max-q=63 -o ../$d.webm clip.yuv
cd ..
fi
done