Measure troughput with -t

This commit is contained in:
Rien Maertens 2020-04-19 15:53:14 +02:00
parent 220d387994
commit a1b14bdf41
No known key found for this signature in database
GPG Key ID: AE66CE42F1AF9DEF
2 changed files with 21 additions and 1 deletions

View File

@ -25,6 +25,7 @@ reMarkable screen sharing over SSH.
- `-o --output`: path of the output where the video should be recorded, as understood by `ffmpeg`; if this is `-`, the video is displayed in a new window and not recorded anywhere (default: `-`)
- `-f --format`: when recording to an output, this option is used to force the encoding format; if this is `-`, `ffmpeg`s auto format detection based on the file extension is used (default: `-`).
- `-w --webcam`: record to a video4linux2 web cam device. By default the first found web cam is taken, this can be overwritten with `-o`. The video is scaled to 1280x720 to ensure compatibility with MS Teams, Skype for business and other programs which need this specific format.
- `-t --throughput`: use `pv` to measure how much data throughput you have (good to experiment with parameters to speed up the pipeline)
If you have problems, don't hesitate to [open an issue](https://github.com/rien/reStream/issues/new) or [send me an email](mailto:rien.maertens@posteo.be).

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" \