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
a9604708
Commit
a9604708
authored
May 19, 2020
by
Martin Schrott
Browse files
added new feature: download / save meeting as lossless mkv
parent
4eba9ecf
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/docker-compose.yml.example
View file @
a9604708
...
...
@@ -28,6 +28,8 @@ services:
- BBB_END_INTRO_AT=
# Media server url:
- BBB_STREAM_URL=rtmp://media_server_url/stream/stream_key
# Timezone (default: Europe/Vienna):
- TZ=Europe/Vienna
volumes:
- ./videodata:/video
startStream.sh
View file @
a9604708
...
...
@@ -7,9 +7,9 @@ then
fi
STREAM_MEETING
=
""
;
if
[
"
${
BBB_
S
STREAM_URL
}
"
=
"
true
"
]
if
[
"
${
BBB_STREAM_URL
}
"
!
=
""
]
then
STREAM_MEETING
=
"-l"
;
STREAM_MEETING
=
"-l
-t
${
BBB_STREAM_URL
}
"
;
fi
DOWNLOAD_MEETING
=
""
;
...
...
@@ -72,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
"
$STREAM_MEETING
$INTRO
$BEGIN_INTRO
$END_INTRO
$JOIN_AS_MODERATOR
$DOWNLOAD_MEETING
;
xvfb-run
-n
122
--server-args
=
"-screen 0 1920x1080x24"
python3 stream.py
-s
${
BBB_URL
}
-p
${
BBB_SECRET
}
-i
${
BBB_MEETING_ID
}
-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 @
a9604708
...
...
@@ -12,6 +12,9 @@ from selenium.webdriver.support.ui import WebDriverWait
from
selenium.webdriver.support
import
expected_conditions
as
EC
from
selenium.webdriver.common.by
import
By
from
datetime
import
datetime
downloadProcess
=
None
browser
=
None
selelnium_timeout
=
30
connect_timeout
=
5
...
...
@@ -114,29 +117,49 @@ def stream_intro():
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
)
introEnd
=
"-t
o
%s"
%
(
args
.
endIntroAt
)
ffmpeg_stream
=
'ffmpeg -re %s %s -thread_queue_size 1024 -i %s
-thread_queue_size 1024
%s -threads 0 %s -f flv "%s"'
%
(
introBegin
,
introEnd
,
args
.
intro
,
audio_options
,
video_options
,
args
.
target
)
ffmpeg_args
=
shlex
.
split
(
ffmpeg_stream
)
logging
.
info
(
"streaming intro..."
)
p
=
subprocess
.
call
(
ffmpeg_args
)
def
stream
():
audio_options
=
'-f alsa -i pulse -ac 2 -c:a aac -b:a 160k -ar 44100'
#video_options = ' -c:v libvpx-vp9 -b:v 2000k -crf 33 -quality realtime -speed 5'
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_stream
=
'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080 -i :%d
-thread_queue_size 1024
%s -threads 0 %s -f flv -flvflags no_duration_filesize "%s"'
%
(
122
,
audio_options
,
video_options
,
args
.
target
)
ffmpeg_args
=
shlex
.
split
(
ffmpeg_stream
)
logging
.
info
(
"streaming meeting..."
)
p
=
subprocess
.
call
(
ffmpeg_args
)
def
download
():
downloadFile
=
"/video/meeting-%s.mkv"
%
fileTimeStamp
audio_options
=
'-f alsa -i pulse -ac 2'
video_options
=
'-c:v libx264rgb -crf 0 -preset ultrafast'
ffmpeg_stream
=
'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080 -i :%d -thread_queue_size 1024 %s %s %s'
%
(
122
,
audio_options
,
video_options
,
downloadFile
)
ffmpeg_args
=
shlex
.
split
(
ffmpeg_stream
)
logging
.
info
(
"saving meeting as %s"
%
downloadFile
)
return
subprocess
.
Popen
(
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
)
# current date and time
now
=
datetime
.
now
()
fileTimeStamp
=
now
.
strftime
(
"%Y%m%d%H%M%S"
)
set_up
()
if
args
.
intro
:
if
args
.
stream
and
args
.
intro
:
stream_intro
()
if
args
.
stream
or
args
.
download
:
bbb_browser
()
if
args
.
download
:
downloadProcess
=
download
()
if
args
.
stream
:
stream
()
if
downloadProcess
:
downloadProcess
.
communicate
(
input
=
None
)
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