-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord
More file actions
executable file
·38 lines (28 loc) · 829 Bytes
/
Copy pathrecord
File metadata and controls
executable file
·38 lines (28 loc) · 829 Bytes
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
#!/bin/sh
# Record.sh
# =========
# this is script which recording from a v4l2 device.
SCRIPTDIR=$(cd -P $(dirname "$0") && pwd -P)
NOWTIME=$(date +'%Y%m%d%H%M%S')
GLOBALCONF="${SCRIPTDIR}/config/global.conf"
OUTPUTDIR="${HOME}/Videos/Source"
OUTPUTFILE="${OUTPUTDIR}/record-${NOWTIME}.mkv"
FFMPEG_VCODECOPTS='-vcodec libx264 -q 20 -preset fast -tune zerolatency'
FFMPEG_ACODECOPTS='-acodec flac'
OUTPUT_OPTS='-f matroska'
log() {
echo "$1" >2
}
if [ ! -e "${GLOBALCONF}" ]; then
log "Can't open ${GLOBALCONF}."
exit 1
fi
. "${GLOBALCONF}"
[ -d "${OUTPUTDIR}" ] || mkdir "${OUTPUTDIR}"
exec ${FFMPEG} -y -threads 0 \
-f ${VIDEO_SRC_FMT} -i ${VIDEO_SRC_DEV} \
-f ${AUDIO_SRC_FMT} -i ${AUDIO_SRC_DEV} \
${FFMPEG_VCODECOPTS} \
${FFMPEG_ACODECOPTS} \
${OUTPUT_OPTS} \
"${OUTPUTFILE}"