fix v4l2
This commit is contained in:
parent
c5c55de2d5
commit
b6235368bd
37
reStream.sh
37
reStream.sh
@ -3,12 +3,12 @@
|
||||
# default values for arguments
|
||||
remarkable="${REMARKABLE_IP:-10.11.99.1}" # remarkable IP address
|
||||
#remarkable="${REMARKABLE_IP:-10.143.0.112}" # remarkable IP address
|
||||
landscape=true # rotate 90 degrees to the right
|
||||
output_path=- # display output through ffplay
|
||||
format=- # automatic output format
|
||||
webcam=false # not to a webcam
|
||||
hflip=false # horizontal flip webcam
|
||||
window_title=reStream # stream window title is reStream
|
||||
landscape=true # rotate 90 degrees to the right
|
||||
output_path=/dev/video5 # display output through ffplay
|
||||
format=- # automatic output format
|
||||
webcam=true # not to a webcam
|
||||
hflip=false # horizontal flip webcam
|
||||
window_title=reStream # stream window title is reStream
|
||||
|
||||
ssh_cmd() {
|
||||
echo "[SSH]" "$@" >&2
|
||||
@ -49,17 +49,26 @@ video_filters="colorlevels=rimin=0:rimax=29/255:gimin=0:gimax=29/255:bimin=0:bim
|
||||
# rotate 90 degrees if landscape=true
|
||||
$landscape && video_filters="$video_filters,transpose=1"
|
||||
|
||||
# Scale and add padding if we are targeting a webcam because a lot of services
|
||||
# expect a size of exactly 1280x720 (tested in Firefox, MS Teams, and Skype for
|
||||
# for business). Send a PR if you can get a higher resolution working.
|
||||
if $webcam; then
|
||||
video_filters="$video_filters,format=pix_fmts=yuv420p"
|
||||
video_filters="$video_filters,scale=-1:720"
|
||||
video_filters="$video_filters,pad=1280:0:-1:0:#eeeeee"
|
||||
format="v4l2"
|
||||
|
||||
# check if there is a modprobed v4l2 loopback device
|
||||
# use the first cam as default if there is no output_path already
|
||||
cam_path=$(v4l2-ctl --list-devices |
|
||||
sed -n '/^[^\s]\+platform:v4l2loopback/{n;s/\s*//g;p;q}')
|
||||
|
||||
# fail if there is no such device
|
||||
if [ -e "$cam_path" ]; then
|
||||
if [ "$output_path" = "-" ]; then
|
||||
output_path="$cam_path"
|
||||
fi
|
||||
else
|
||||
echo "Could not find a video loopback device, did you"
|
||||
echo "sudo modprobe v4l2loopback"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Some applications, eg Zoom and Discord, mirror by default the webcam video
|
||||
# Restore the correct orientation
|
||||
$hflip && video_filters="$video_filters,hflip"
|
||||
fi
|
||||
|
||||
# set each frame presentation time to the time it is received
|
||||
|
Loading…
x
Reference in New Issue
Block a user