From 6edfa84af9d163ab8a2af89302a06d9be77bf024 Mon Sep 17 00:00:00 2001 From: David Blajda Date: Fri, 27 Mar 2020 19:37:34 +0000 Subject: Modify pipeline and add forward obs script --- prepare-videochat.sh | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'prepare-videochat.sh') diff --git a/prepare-videochat.sh b/prepare-videochat.sh index ffbb142..e3d91d7 100755 --- a/prepare-videochat.sh +++ b/prepare-videochat.sh @@ -163,11 +163,11 @@ PORT=8080 DISABLE_PROXY=0 # Dimensions of video -WIDTH=640 -HEIGHT=480 +WIDTH=1920 +HEIGHT=1080 # Frame rate of video -GST_FPS=24 +GST_FPS=30 # Choose audio codec from wav, aac or opus # do not choose opus until editing pipeline. If choose opus, pipeline will not work @@ -178,16 +178,16 @@ AUDIO_CODEC=wav # Choose which stream to capture. # a - audio only, v - video only, av - audio and video. # Make sure that IP webcam is streaming corresponding streams, otherwise error will occur. -CAPTURE_STREAM=av +CAPTURE_STREAM=v # Loopback device to be used. This only needs to be uncommented if you # want to skip autodetection (e.g. for multiple webcams): -#DEVICE=/dev/video0 +DEVICE=/dev/video1 # Force syncing to timestamps. Useful to keep audio and video in sync, # but may impact performance in slow connections. If you see errors about # timestamping or you do not need audio, you can try changing this to false. -SYNC=true +SYNC=false ### FUNCTIONS @@ -372,7 +372,7 @@ GST_AUDIO_CAPS="$GST_AUDIO_MIMETYPE,$GST_AUDIO_FORMAT$GST_AUDIO_LAYOUT,$GST_AUDI PA_AUDIO_CAPS="$GST_AUDIO_FORMAT $GST_AUDIO_RATE $GST_AUDIO_CHANNELS" # GStreamer debug string (see gst-launch manpage) -GST_DEBUG=souphttpsrc:0,videoflip:0,$GST_CONVERTER:0,v4l2sink:0,pulse:0 +GST_DEBUG=souphttpsrc:0,videoflip:0,$GST_CONVERTER:5,v4l2sink:5,pulse:0 # Is $GST_CONVERTER defined anywhere? Maybe you mean videoconvert vs ffmpegcolorspace? It is in GST_VIDEO_CONVERTER ### MAIN BODY @@ -475,10 +475,10 @@ if can_run "$ADB"; then fi # Remind the user to open up IP Webcam and start the server -if phone_plugged && ! iw_server_is_started; then - # If the phone is plugged to USB and we have ADB, we can start the server by sending an intent - start_iw_server -fi +#if phone_plugged && ! iw_server_is_started; then +# # If the phone is plugged to USB and we have ADB, we can start the server by sending an intent +# start_iw_server +#fi while ! iw_server_is_started; do if [ $CAPTURE_STREAM = av ]; then @@ -542,18 +542,11 @@ fi # Start the GStreamer graph needed to grab the video and audio set +e -#sudo v4l2loopback-ctl set-caps $GST_0_10_VIDEO_CAPS $DEVICE - pipeline_video() { - echo souphttpsrc location="$VIDEO_URL" do-timestamp=true is-live=true \ - ! multipartdemux \ - ! decodebin \ - $GST_FLIP \ - ! $GST_VIDEO_CONVERTER \ - ! videoscale \ - ! videorate \ - ! $GST_VIDEO_CAPS \ - ! v4l2sink device="$DEVICE" sync=$SYNC + echo souphttpsrc location="$VIDEO_URL" is-live=true \ + ! jpegdec \ + ! videoconvert \ + ! v4l2sink device="$DEVICE" } pipeline_audio() { @@ -605,6 +598,7 @@ kill $GSTLAUNCH_PID > /dev/null 2>&1 || echo "" pactl set-default-source ${DEFAULT_SOURCE} pactl unload-module ${ECANCEL_ID} pactl unload-module ${SINK_ID} +adb forward --remove tcp:$PORT echo "Disconnected from IP Webcam. Have a nice day!" # idea: capture ctrl-c signal and set default source back -- cgit v1.2.3