-
Notifications
You must be signed in to change notification settings - Fork 10
/
record-mixed-av.sh
executable file
·52 lines (42 loc) · 1.71 KB
/
record-mixed-av.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
#!/bin/sh
# Copyright: 2015,2016 Carl F. Karsten <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# $1 - destination dir. default: ~/Videos
# files will be $dest_dir/$date/$time.gs.ts
# (.gs to keep these apart from the files created by record-timestamp.sh)
# NB: does not chunk files. keeps saving untill the process is killed.
# TODO: https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-splitmuxsink.html
# splitmuxsink — Muxer wrapper for splitting output stream by size or time
# https://gstreamer.freedesktop.org/documentation/multifile/splitmuxsink.html?gi-language=c#splitmuxsink
dest_dir=${1:-~/Videos}/$(date +%Y-%m-%d)
mkdir -p $dest_dir
gst-launch-1.0 \
tcpclientsrc host=localhost port=11000 !\
\
matroskademux name=demux \
\
demux. !\
queue !\
videoconvert !\
avenc_mpeg2video bitrate=5000000 max-key-interval=0 !\
queue !\
mux. \
\
demux. !\
queue !\
audioconvert !\
avenc_mp2 bitrate=192000 !\
queue !\
mux. \
\
mpegtsmux name=mux !\
filesink location="$dest_dir/$(date +%H_%M_%S).gs.ts"