Store extra ffmpeg arguments in $@
This commit is contained in:
parent
0c707af239
commit
3609b990ff
24
reStream.sh
24
reStream.sh
@ -71,7 +71,7 @@ fi
|
|||||||
if [ -z "$compress" ]; then
|
if [ -z "$compress" ]; then
|
||||||
echo "Your remarkable does not have lz4."
|
echo "Your remarkable does not have lz4."
|
||||||
fallback_to_gzip
|
fallback_to_gzip
|
||||||
elif ! which lz4; then
|
elif ! lz4 -V; then
|
||||||
echo "Your host does not have lz4."
|
echo "Your host does not have lz4."
|
||||||
fallback_to_gzip
|
fallback_to_gzip
|
||||||
else
|
else
|
||||||
@ -80,39 +80,41 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# list of ffmpeg filters to apply
|
||||||
output_args=""
|
|
||||||
video_filters=""
|
video_filters=""
|
||||||
|
|
||||||
|
# store extra ffmpeg arguments in $@
|
||||||
|
set --
|
||||||
|
|
||||||
# calculate how much bytes the window is
|
# calculate how much bytes the window is
|
||||||
window_bytes="$((width * height * bytes_per_pixel))"
|
window_bytes="$((width * height * bytes_per_pixel))"
|
||||||
|
|
||||||
# rotate 90 degrees if landscape=true
|
# rotate 90 degrees if landscape=true
|
||||||
$landscape && video_filters="$video_filters,transpose=1"
|
$landscape && video_filters="$video_filters,transpose=1"
|
||||||
|
|
||||||
|
# set each frame presentation time to the time it is received
|
||||||
|
video_filters="$video_filters,setpts=(RTCTIME - RTCSTART) / (TB * 1000000)"
|
||||||
|
|
||||||
# read the first $window_bytes of the framebuffer
|
# read the first $window_bytes of the framebuffer
|
||||||
head_fb0="dd if=/dev/fb0 count=1 bs=$window_bytes 2>/dev/null"
|
head_fb0="dd if=/dev/fb0 count=1 bs=$window_bytes 2>/dev/null"
|
||||||
|
|
||||||
# loop that keeps on reading and compressing, to be executed remotely
|
# loop that keeps on reading and compressing, to be executed remotely
|
||||||
read_loop="while $head_fb0; do $loop_wait; done | $compress"
|
read_loop="while $head_fb0; do $loop_wait; done | $compress"
|
||||||
|
|
||||||
|
set -- "$@" -vf "${video_filters#,}"
|
||||||
|
|
||||||
if [ "$output_path" = - ]; then
|
if [ "$output_path" = - ]; then
|
||||||
output_cmd=ffplay
|
output_cmd=ffplay
|
||||||
else
|
else
|
||||||
output_cmd=ffmpeg
|
output_cmd=ffmpeg
|
||||||
|
|
||||||
if [ "$format" != - ]; then
|
if [ "$format" != - ]; then
|
||||||
output_args="$output_args -f '$format' "
|
set -- "$@" -f "$format"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
output_args="$output_args '$output_path'"
|
set -- "$@" "$output_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set frame presentation time to the time it was received
|
|
||||||
video_filters="$video_filters,setpts=(RTCTIME - RTCSTART) / (TB * 1000000)"
|
|
||||||
|
|
||||||
output_args="$output_args -vf '${video_filters#,}'"
|
|
||||||
|
|
||||||
set -e # stop if an error occurs
|
set -e # stop if an error occurs
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
@ -125,4 +127,4 @@ ssh_cmd "$read_loop" \
|
|||||||
-pixel_format gray16le \
|
-pixel_format gray16le \
|
||||||
-video_size "$width,$height" \
|
-video_size "$width,$height" \
|
||||||
-i - \
|
-i - \
|
||||||
"${output_args[@]}"
|
"$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user