summaryrefslogtreecommitdiff
path: root/tools/ipcam_rtsp2hls.sh
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-05-25 00:10:35 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-05-25 00:10:35 +0300
commitd454ac4a1bad26ee3bedebe8d0902ccda2ad1750 (patch)
tree0366e5e8802324e1a5ddc692dfbaa368fdac5832 /tools/ipcam_rtsp2hls.sh
parentf9991f455511b2993b22e54c982cf506adc10808 (diff)
ipcam_rtsp2hls: support specifying rtsp transport protocol
Diffstat (limited to 'tools/ipcam_rtsp2hls.sh')
-rwxr-xr-xtools/ipcam_rtsp2hls.sh25
1 files changed, 22 insertions, 3 deletions
diff --git a/tools/ipcam_rtsp2hls.sh b/tools/ipcam_rtsp2hls.sh
index d52fb8a..a468715 100755
--- a/tools/ipcam_rtsp2hls.sh
+++ b/tools/ipcam_rtsp2hls.sh
@@ -9,6 +9,8 @@ USER=
PASSWORD=
DEBUG=0
CHANNEL=1
+FORCE_UDP=0
+FORCE_TCP=0
die() {
echo >&2 "error: $@"
@@ -26,6 +28,8 @@ Options:
--user
--password
--debug
+ --force-tcp
+ --force-udp
--channel 1|2
EOF
@@ -59,6 +63,14 @@ while [[ $# -gt 0 ]]; do
DEBUG=1
;;
+ --force-tcp)
+ FORCE_TCP=1
+ ;;
+
+ --force-udp)
+ FORCE_UDP=1
+ ;;
+
--channel)
CHANNEL="$2"
shift
@@ -82,13 +94,20 @@ if [ ! -d "${OUTDIR}/${NAME}" ]; then
mkdir "${OUTDIR}/${NAME}" || die "Failed to create ${OUTDIR}/${NAME}!"
fi
+args=
if [ "$DEBUG" = "1" ]; then
- ffmpeg_args="-v info"
+ args="-v info"
else
- ffmpeg_args="-nostats -loglevel error"
+ args="-nostats -loglevel error"
+fi
+
+if [ "$FORCE_TCP" = "1" ]; then
+ args="$args -rtsp_transport tcp"
+elif [ "$FORCE_UDP" = "1" ]; then
+ args="$args -rtsp_transport udp"
fi
-ffmpeg $ffmpeg_args -i rtsp://${USER}:${PASSWORD}@${IP}:${PORT}/Streaming/Channels/${CHANNEL} \
+ffmpeg $args -i rtsp://${USER}:${PASSWORD}@${IP}:${PORT}/Streaming/Channels/${CHANNEL} \
-c:v copy -c:a copy -bufsize 1835k \
-pix_fmt yuv420p \
-flags -global_header -hls_time 5 -hls_list_size 6 -hls_wrap 5 \