Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
agetic
librecast
Commits
229c5ba8
Commit
229c5ba8
authored
Sep 20, 2017
by
Carlos Remuzzi
Committed by
Carlos Remuzzi
Dec 07, 2017
Browse files
terminando activacion con h264
parent
9d877bef
Changes
1
Hide whitespace changes
Inline
Side-by-side
librecast
View file @
229c5ba8
...
...
@@ -24,6 +24,50 @@ invocar_nmcli() {
fi
}
invocar_pacmd
()
{
pacmd unload-module module-null-sink
pacmd load-module module-null-sink
sink_name
=
libreCast
pacmd update-sink-proplist libreCast device.description
=
libreCast
pacmd set-default-sink libreCast
}
invocar_gst
()
{
SIZE_STRING
=
$(
xdpyinfo |
awk
'/dimensions/{print $2}'
)
SCREEN_WIDTH
=
"
$(
cut
-d
'x'
-f1
<<<
"
$SIZE_STRING
"
)
"
SCREEN_HEIGHT
=
"
$(
cut
-d
'x'
-f2
<<<
"
$SIZE_STRING
"
)
"
# por defecto no realizamos ningun recorte
CROP_STRING_X
=
""
CROP_STRING_Y
=
""
# en caso el ancho supere lo maximo consentido de 1920
if
[
"
$SCREEN_WIDTH
"
-gt
1920
]
;
then
echo
"recortando el ancho de la pantalla ..."
SCREEN_WIDTH
=
1920
CROP_STRING_X
=
"startx=0 endx=1919"
CROP_STRING_Y
=
"starty=0 endy=
$((
$SCREEN_HEIGHT
-
1
))
"
fi
# en caso el alto supere lo maximo consentido de 1080
if
[
"
$SCREEN_HEIGHT
"
-gt
1080
]
;
then
echo
"recortando el alto de la pantalla..."
SCREEN_HEIGHT
=
1080
CROP_STRING_X
=
"startx=0 endx=
$((
$SCREEN_WIDTH
-
1
))
"
CROP_STRING_Y
=
"starty=0 endy=1079"
fi
video_gst
=
"gst-launch-1.0 ximagesrc use-damage=false
$CROP_STRING_X
$CROP_STRING_Y
! videoconvert ! videoscale ! video/x-raw,format=I420,width=
$SCREEN_WIDTH
,height=
$SCREEN_HEIGHT
,framerate=24/1,bitrate=6000 ! jpegenc quality=80 ! rtpjpegpay ! udpsink host=
$AP_ADDRESS
port=1234 sync=false"
audio_gst
=
"gst-launch-1.0 pulsesrc device=libreCast.monitor ! audio/x-raw,rate=11500,channels=2,depth=16 ! udpsink host=
$AP_ADDRESS
port=5678 sync=false"
if
[
"
$CODEC
"
==
"h264"
]
;
then
echo
"cambiando gst pipe para h264 ..."
video_gst
=
"gst-launch-1.0 ximagesrc use-damage=false
$CROP_STRING_X
$CROP_STRING_Y
! videoconvert ! videoscale ! video/x-raw,width=
$SCREEN_WIDTH
,height=
$SCREEN_HEIGHT
,framerate=24/1 ! vaapih264enc bitrate=6000 ! rtph264pay config-interval=1 pt=96 ! udpsink host=
$AP_ADDRESS
port=1234 sync=false"
fi
$video_gst
&
$audio_gst
&
}
main
()
{
if
[
-z
"
$(
pidof gst-launch-1.0
)
"
]
;
then
...
...
@@ -39,44 +83,12 @@ main() {
fi
fi
SIZE_STRING
=
$(
xdpyinfo |
awk
'/dimensions/{print $2}'
)
SCREEN_WIDTH
=
"
$(
cut
-d
'x'
-f1
<<<
"
$SIZE_STRING
"
)
"
SCREEN_HEIGHT
=
"
$(
cut
-d
'x'
-f2
<<<
"
$SIZE_STRING
"
)
"
# por defecto no realizamos ningun recorte
CROP_STRING_X
=
""
CROP_STRING_Y
=
""
# en caso el ancho supere lo maximo consentido de 1920
if
[
"
$SCREEN_WIDTH
"
-gt
1920
]
;
then
echo
"recortando el ancho de la pantalla ..."
SCREEN_WIDTH
=
1920
CROP_STRING_X
=
"startx=0 endx=1919"
CROP_STRING_Y
=
"starty=0 endy=
$((
$SCREEN_HEIGHT
-
1
))
"
fi
# en caso el alto supere lo maximo consentido de 1080
if
[
"
$SCREEN_HEIGHT
"
-gt
1080
]
;
then
echo
"recortando el alto de la pantalla..."
SCREEN_HEIGHT
=
1080
CROP_STRING_X
=
"startx=0 endx=
$((
$SCREEN_WIDTH
-
1
))
"
CROP_STRING_Y
=
"starty=0 endy=1079"
fi
curl
--connect-timeout
3
-s
-k
-X
GET https://
$AP_ADDRESS
:5443/player/start?codec
=
h264 |
grep
'Player iniciado'
curl
--connect-timeout
3
-s
-k
-X
GET https://
$AP_ADDRESS
:5443/player/start?codec
=
$CODEC
|
grep
'Player iniciado'
if
[
$?
-eq
0
]
;
then
pacmd unload-module module-null-sink
pacmd load-module module-null-sink
sink_name
=
libreCast
pacmd update-sink-proplist libreCast device.description
=
libreCast
pacmd set-default-sink libreCast
gst-launch-1.0
-v
ximagesrc use-damage
=
false
$CROP_STRING_X
$CROP_STRING_Y
!
videoconvert
!
videoscale
!
video/x-raw,width
=
$SCREEN_WIDTH
,height
=
$SCREEN_HEIGHT
,framerate
=
24/1
!
vaapih264enc
bitrate
=
6000
!
rtph264pay config-interval
=
1
pt
=
96
!
udpsink
host
=
$AP_ADDRESS
port
=
1234
sync
=
false
&
# gst-launch-1.0 ximagesrc use-damage=false $CROP_STRING_X $CROP_STRING_Y ! videoconvert ! videoscale ! video/x-raw,format=I420,width=$SCREEN_WIDTH,height=$SCREEN_HEIGHT,framerate=24/1,bitrate=6000 ! jpegenc quality=80 ! rtpjpegpay ! udpsink host=$AP_ADDRESS port=1234 sync=false &
gst-launch-1.0 pulsesrc
device
=
"libreCast.monitor"
!
"audio/x-raw,rate=11500,channels=2,depth=16"
!
udpsink
host
=
$AP_ADDRESS
port
=
5678
sync
=
false
&
invocar_pacmd
invocar_gst
exit
0
else
# the player is already running or the player is not reachable
exit
1
fi
else
...
...
@@ -98,6 +110,7 @@ main() {
# por defecto apuntamos a la ip predefinida del AP wifi
AP_ADDRESS
=
192.168.12.1
CODEC
=
"mjpeg"
if
[
$#
-eq
1
]
;
then
if
valid_ip
$1
;
then
...
...
@@ -108,8 +121,17 @@ if [ $# -eq 1 ];then
fi
if
[
$#
-eq
2
]
;
then
AP_ADDRESS
=
$1
AP_NAME
=
$2
case
"
$2
"
in
h264
)
CODEC
=
h264
;;
mjpeg
)
CODEC
=
mjpeg
;;
*
)
AP_NAME
=
$2
;;
esac
;
fi
echo
"enviando a la direccion
$AP_ADDRESS
"
echo
"adoptando codec
$CODEC
"
main
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment