Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Sergio Vergata
BigBlueButton LiveStreaming
Commits
af1107db
Commit
af1107db
authored
May 19, 2020
by
Martin Schrott
Browse files
added new function: play intro
parent
d0a84c03
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/docker-compose.yml.example
View file @
af1107db
...
...
@@ -18,5 +18,18 @@ services:
- BBB_MODERATOR_PASSWORD=JjeQYksarqLQ
# meeting title (optional):
- BBB_MEETING_TITLE=liveStreaming Test
# stream BigblueButton meeting
- BBB_SSTREAM_MEETING=true
# download / save BigBlueButton meeting
- BBB_DOWNLOAD_MEETING=false
# play intro file (can be a local file in videodata folder e.g. /video/intro.mp4 or a url of a mediastream e.g. https://my.intro.stream)
- BBB_INTRO=false
# begin the intro at position (optional, e.g. 00:00:05)
- BBB_BEGIN_INTRO_AT=04:40
# end intro after (optional, e.g. 01:00:00 - after one hour)
- BBB_END_INTRO_AT=
# Media server url:
- BBB_STREAM_URL=rtmp://media_server_url/stream/stream_key
volumes:
- ./videodata:/video
startStream.sh
View file @
af1107db
...
...
@@ -6,12 +6,42 @@ then
JOIN_AS_MODERATOR
=
"-m"
;
fi
STREAM_MEETING
=
""
;
if
[
"
${
BBB_SSTREAM_MEETING
}
"
=
"true"
]
then
STREAM_MEETING
=
"-l"
;
fi
DOWNLOAD_MEETING
=
""
;
if
[
"
${
BBB_DOWNLOAD_MEETING
}
"
=
"true"
]
then
DOWNLOAD_MEETING
=
"-d"
;
fi
SHOW_CHAT
=
""
;
if
[
"
${
BBB_SHOW_CHAT
}
"
=
"true"
]
then
SHOW_CHAT
=
"-c"
;
fi
INTRO
=
""
;
if
[
"
${
BBB_INTRO
}
"
!=
""
]
then
INTRO
=
"-I
${
BBB_INTRO
}
"
;
fi
BEGIN_INTRO
=
""
;
if
[
"
${
BBB_BEGIN_INTRO_AT
}
"
!=
""
]
then
BEGIN_INTRO
=
"-B
${
BBB_BEGIN_INTRO_AT
}
"
;
fi
END_INTRO
=
""
;
if
[
"
${
BBB_END_INTRO_AT
}
"
!=
""
]
then
END_INTRO
=
"-E
${
BBB_END_INTRO_AT
}
"
;
fi
START_MEETING
=
""
;
if
[
"
${
BBB_START_MEETING
}
"
!=
""
]
then
...
...
@@ -42,4 +72,4 @@ then
sleep
10
fi
xvfb-run
-n
122
--server-args
=
"-screen 0 1920x1080x24"
python3 stream.py
-s
${
BBB_URL
}
-p
${
BBB_SECRET
}
-i
${
BBB_MEETING_ID
}
-t
${
BBB_STREAM_URL
}
-u
${
BBB_USER_NAME
}
${
SHOW_CHAT
}
$START_MEETING
$ATTENDEE_PASSWORD
$MODERATOR_PASSWORD
-T
"
$MEETING_TITLE
"
$
JOIN_AS_MODERATOR
;
xvfb-run
-n
122
--server-args
=
"-screen 0 1920x1080x24"
python3 stream.py
-s
${
BBB_URL
}
-p
${
BBB_SECRET
}
-i
${
BBB_MEETING_ID
}
-t
${
BBB_STREAM_URL
}
-u
${
BBB_USER_NAME
}
${
SHOW_CHAT
}
$START_MEETING
$ATTENDEE_PASSWORD
$MODERATOR_PASSWORD
-T
"
$MEETING_TITLE
"
$
STREAM_MEETING
$INTRO
$BEGIN_INTRO
$END_INTRO
$JOIN_AS_MODERATOR
$DOWNLOAD_MEETING
;
stream.py
View file @
af1107db
...
...
@@ -22,6 +22,11 @@ parser = argparse.ArgumentParser()
parser
.
add_argument
(
"-s"
,
"--server"
,
help
=
"Big Blue Button Server URL"
)
parser
.
add_argument
(
"-p"
,
"--secret"
,
help
=
"Big Blue Button Secret"
)
parser
.
add_argument
(
"-i"
,
"--id"
,
help
=
"Big Blue Button Meeting ID"
)
parser
.
add_argument
(
"-I"
,
"--intro"
,
help
=
"Intro file to play before streaming"
)
parser
.
add_argument
(
"-B"
,
"--beginIntroAt"
,
help
=
"begin intro at position (e.g. 00:01:05)"
)
parser
.
add_argument
(
"-E"
,
"--endIntroAt"
,
help
=
"End intro at position (e.g. 01:00:04)"
)
parser
.
add_argument
(
"-l"
,
"--stream"
,
help
=
"live stream a BigBlueButton meeting"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-d"
,
"--download"
,
help
=
"download / save a BigBlueButton meeting"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-m"
,
"--moderator"
,
help
=
"Join the meeting as moderator"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-S"
,
"--startMeeting"
,
help
=
"start the meeting if not running"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-A"
,
"--attendeePassword"
,
help
=
"attendee password (required to create meetings)"
)
...
...
@@ -101,9 +106,18 @@ def get_join_url():
pwd
=
minfo
.
get_meetinginfo
().
get_attendeepw
()
return
bbb
.
get_join_meeting_url
(
args
.
user
,
args
.
id
,
pwd
)
def
watch
():
while
True
:
time
.
sleep
(
60
)
def
stream_intro
():
audio_options
=
'-f alsa -i pulse -ac 2 -c:a aac -b:a 160k -ar 44100'
video_options
=
'-c:v libx264 -x264-params "nal-hrd=cbr" -profile:v high -level:v 4.2 -vf format=yuv420p -b:v 4000k -maxrate 4000k -minrate 2000k -bufsize 8000k -g 60 -preset ultrafast'
introBegin
=
""
if
args
.
beginIntroAt
:
introBegin
=
"-ss %s"
%
(
args
.
beginIntroAt
)
introEnd
=
""
if
args
.
endIntroAt
:
introEnd
=
"-t %s"
%
(
args
.
endIntroAt
)
ffmpeg_stream
=
'ffmpeg -re %s %s -thread_queue_size 1024 -i %s %s -threads 0 %s -f flv "%s"'
%
(
introBegin
,
introEnd
,
args
.
intro
,
audio_options
,
video_options
,
args
.
target
)
ffmpeg_args
=
shlex
.
split
(
ffmpeg_stream
)
p
=
subprocess
.
call
(
ffmpeg_args
)
def
stream
():
audio_options
=
'-f alsa -i pulse -ac 2 -c:a aac -b:a 160k -ar 44100'
...
...
@@ -111,14 +125,18 @@ def stream():
video_options
=
'-c:v libx264 -x264-params "nal-hrd=cbr" -profile:v high -level:v 4.2 -vf format=yuv420p -b:v 4000k -maxrate 4000k -minrate 2000k -bufsize 8000k -g 60 -preset ultrafast -tune zerolatency'
ffmpeg_stream
=
'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080 -i :%d %s -threads 0 %s -f flv -flvflags no_duration_filesize "%s"'
%
(
122
,
audio_options
,
video_options
,
args
.
target
)
ffmpeg_args
=
shlex
.
split
(
ffmpeg_stream
)
p
=
subprocess
.
Popen
(
ffmpeg_args
)
p
=
subprocess
.
call
(
ffmpeg_args
)
if
args
.
startMeeting
is
False
:
while
bbb
.
is_meeting_running
(
args
.
id
).
is_meeting_running
()
!=
True
:
logging
.
info
(
"Meeting isn't running. We will try again in %d seconds!"
%
connect_timeout
)
time
.
sleep
(
connect_timeout
)
set_up
()
bbb_browser
()
stream
()
watch
()
browser
.
quit
()
\ No newline at end of file
if
args
.
intro
:
stream_intro
()
if
args
.
stream
or
args
.
download
:
bbb_browser
()
if
args
.
stream
:
stream
()
if
browser
:
browser
.
quit
()
Write
Preview
Markdown
is supported
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