forked from theyosh/TerrariumPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlive_rpicam.sh
executable file
·52 lines (42 loc) · 924 Bytes
/
live_rpicam.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
#!/bin/bash
NAME=$1
WIDTH=$2
HEIGHT=$3
ROTATION=$4
DIR=$5
# Test defaults
if [[ "${NAME}" == "" ]];
then
NAME="Test"
fi
if [[ "${WIDTH}" == "" ]];
then
WIDTH="1920"
fi
if [[ "${HEIGHT}" == "" ]];
then
HEIGHT="1080"
fi
if [[ "${ROTATION}" == "" ]];
then
ROTATION="0"
fi
if [[ "${DIR}" == "" ]];
then
DIR="/dev/shm/test"
fi
if [[ ! -d "${DIR}" ]];
then
mkdir -p "${DIR}"
fi
if [[ "${ROTATION}" == "h" ]];
then
ROTATION="-hf"
elif [[ "${ROTATION}" == "v" ]];
then
ROTATION="-vf"
else
ROTATION="-rot ${ROTATION}"
fi
`which raspivid` -o - -b 2000000 -t 0 -w ${WIDTH} -h ${HEIGHT} ${ROTATION} --drc low -fps 30 -g 30 -pf main -lev 4.1 -ae 16,0xff,0x808000 -a 8 -a " ${NAME} @ %d/%m/%Y %X " -a 1024 | \
`which ffmpeg` -hide_banner -nostdin -re -i - -c:v copy -f hls -hls_time 2 -hls_list_size 3 -hls_flags delete_segments+split_by_time -hls_segment_filename "${DIR}/chunk_%03d.ts" "${DIR}/stream.m3u8"