-
Notifications
You must be signed in to change notification settings - Fork 17
/
rtsp-camera-to-file-bug-demo1.sh
executable file
·66 lines (57 loc) · 2.16 KB
/
rtsp-camera-to-file-bug-demo1.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
#
# Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Demonstrates a huge inefficiency with mpegtsmux when used with rtspsrc.
# With NTP_SYNC=true, output file is 19 MB.
# With NTP_SYNC=false, output file is 7.5 MB.
set -ex
ROOT_DIR=$(readlink -f $(dirname $0)/..)
LOG_FILE="/tmp/$(basename "${0}" .sh).log"
pushd ${ROOT_DIR}/gst-plugin-pravega
cargo build
export GST_PLUGIN_PATH=${ROOT_DIR}/gst-plugin-pravega/target/debug:${GST_PLUGIN_PATH}
# log level can be INFO, DEBUG, or LOG (verbose)
export GST_DEBUG=basetsmux:INFO,mpegtspacketizer:LOG,pravegasink:LOG,basesink:INFO,rtspsrc:INFO,rtpbin:INFO,rtpsession:INFO,rtpjitterbuffer:INFO,identity:INFO,INFO
export RUST_BACKTRACE=1
export GST_DEBUG_DUMP_DOT_DIR="/tmp/gst-dot/$(basename "${0}" .sh)"
rm -rf "${GST_DEBUG_DUMP_DOT_DIR}"
mkdir -p "${GST_DEBUG_DUMP_DOT_DIR}"
TARGET_RATE_KB_PER_SEC=100
BITRATE_KILOBITS_PER_SEC=$(( ${TARGET_RATE_KB_PER_SEC} * 8 ))
CAMERA_ADDRESS=${CAMERA_ADDRESS:-127.0.0.1}
CAMERA_PASSWORD=${CAMERA_PASSWORD:-password}
CAMERA_PATH=${CAMERA_PATH:-"/cam/realmonitor?width=640&height=480&fps=30&show_time=false&target_rate_kilobytes_per_sec=${TARGET_RATE_KB_PER_SEC}"}
CAMERA_PORT=${CAMERA_PORT:-8554}
CAMERA_USER=${CAMERA_USER:-user}
PRAVEGA_STREAM=${PRAVEGA_STREAM:-rtsp6}
NTP_SYNC=true
gst-launch-1.0 \
-v \
--eos-on-shutdown \
rtspsrc \
"location=rtsp://${CAMERA_USER}:${CAMERA_PASSWORD}@${CAMERA_ADDRESS}:${CAMERA_PORT}${CAMERA_PATH}" \
buffer-mode=none \
drop-messages-interval=0 \
drop-on-latency=true \
latency=2000 \
ntp-sync=${NTP_SYNC} \
ntp-time-source=running-time \
rtcp-sync-send-time=false \
! rtph264depay \
! h264parse \
! "video/x-h264,alignment=au,stream-format=byte-stream" \
! identity eos-after=300 silent=true \
! mpegtsmux \
! filesink \
location=${HOME}/test.ts \
$* |& tee ${LOG_FILE}
# ${ROOT_DIR}/scripts/dot-to-png.sh ${GST_DEBUG_DUMP_DOT_DIR}/*.dot
# xdg-open ${GST_DEBUG_DUMP_DOT_DIR}
ls -lh ${HOME}/test.ts