-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-hevc
executable file
·38 lines (35 loc) · 1.23 KB
/
create-hevc
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
#!/bin/bash
START_TIME=$SECONDS
QUALITY=${Q:-25}
WIDTH=${WIDTH:-1920}
SIZING="-vf scale=$WIDTH:-1"
OPT="-y -v info -hide_banner"
STAT=$(stat -c"%y" tl000001.jpg|cut -b1-10|perl -npe "s/(\d+)\-(\d+)\-(\d+)/\3.\2.\1/")
if [ -z $STAT ]; then
echo "couldn't find tl000001.jpg"
echo "wrong directory?"
exit
fi
MOVIE=$(stat -c"%y" tl000001.jpg|cut -d " " --output-delimiter=- -f1,2|cut -b1-10)-hevc-q$QUALITY.mp4
echo -n create_movie $MOVIE ...
# run faster if interactive
if [ -z !$PID ]; then
ffmpeg $OPT -r 30 -f image2 -i tl%06d.jpg \
-metadata title="$STAT Timelapse Grand River" \
-metadata author="Steffen Roller <[email protected]>" \
-metadata year="2018" \
-metadata copyright="Create Commons" \
-an \
-c:v libx265 -crf $QUALITY -r 30 $MOVIE
else
ffmpeg $OPT -r 30 -f image2 -i tl%06d.jpg \
$SIZING \
-metadata title="$STAT Timelapse Grand River" \
-metadata author="Steffen Roller <[email protected]>" \
-metadata year="2018" \
-metadata copyright="Create Commons" \
-an \
-c:v libx265 -crf $QUALITY -r 30 $MOVIE
fi
ELAPSED_TIME=$(($SECONDS - $START_TIME))
echo finished in $(($ELAPSED_TIME/60/60)) hr, $(($ELAPSED_TIME/60%60)) min and $(($ELAPSED_TIME % 60)) sec