Measure troughput with -t

This commit is contained in:
Rien Maertens
2020-04-19 15:53:14 +02:00
parent 220d387994
commit a1b14bdf41
2 changed files with 21 additions and 1 deletions

View File

@ -6,6 +6,7 @@ landscape=true # rotate 90 degrees to the right
output_path=- # display output through ffplay
format=- # automatic output format
webcam=false # not to a webcam
measure_throughput=false # measure how fast data is being transferred
# loop through arguments and process them
while [ $# -gt 0 ]; do
@ -29,6 +30,10 @@ while [ $# -gt 0 ]; do
shift
shift
;;
-t | --throughput)
measure_throughput=true
shift
;;
-w | --webcam)
webcam=true
format="v4l2"
@ -100,13 +105,26 @@ fi
if [ -z "$compress" ]; then
echo "Your remarkable does not have lz4."
fallback_to_gzip
elif ! lz4 -V; then
elif ! lz4 -V > /dev/null; then
echo "Your host does not have lz4."
fallback_to_gzip
else
decompress="lz4 -d"
fi
# use pv to measure throughput if desired, else we just pipe through cat
if $measure_throughput; then
if ! pv --version > /dev/null; then
echo "You need to install pv to measure data throughput."
exit 1
else
loglevel="error" # verbose ffmpeg output interferes with pv
host_passthrough="pv"
fi
else
host_passthrough="cat"
fi
# list of ffmpeg filters to apply
video_filters=""
@ -164,6 +182,7 @@ set -e # stop if an error occurs
# shellcheck disable=SC2086
ssh_cmd "$read_loop" \
| $decompress \
| $host_passthrough \
| "$output_cmd" \
-vcodec rawvideo \
-loglevel "$loglevel" \